提交 58fe95e0 编写于 作者: W wangjiawei04

another commit test=serving

上级 226b464c
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -17,9 +16,10 @@ import os
import re
import sys
def ReadMarkDown(file):
folder = 'test'
os.system('rm -rf '+ folder + ' && mkdir -p ' + folder)
os.system('rm -rf ' + folder + ' && mkdir -p ' + folder)
with open(file, 'r') as f:
lines = f.readlines()
for i, line in enumerate(lines):
......@@ -31,9 +31,11 @@ def ReadMarkDown(file):
GetTestFile(lines, i, os.path.join(folder, filename))
def GetCodeFile(lines, i , filename):
if '```' not in lines[i+1]:
raise ValueError('Syntax Error, code block should be tightly followed by "[//file]:#" ')
def GetCodeFile(lines, i, filename):
if '```' not in lines[i + 1]:
raise ValueError(
'Syntax Error, code block should be tightly followed by "[//file]:#" '
)
i += 2
code = ''
while True:
......@@ -44,6 +46,7 @@ def GetCodeFile(lines, i , filename):
with open(filename, 'w+') as f:
f.write(code)
def GetTestFile(lines, i, filename):
i += 1
code = ''
......@@ -55,11 +58,13 @@ def GetTestFile(lines, i, filename):
with open(filename, 'w+') as f:
f.write(code)
def RunTest():
folder = 'test'
os.system('cd ' + folder + ' && sh start.sh')
os.system('cd .. && rm -rf ' + folder)
if __name__ == '__main__':
ReadMarkDown(os.path.join(sys.argv[1], sys.argv[2]))
RunTest()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册