4def extract_test_args(s):
5 p = re.compile(
'eval\\((.*)\\)')
10def pytest_addoption(parser):
11 parser.addoption(
"--test_list", action=
"store", help=
"Path to test list")
12 parser.addoption(
"--tflite_dir",
14 help=
"Directory including tflite file")
15 parser.addoption(
"--circle_dir",
17 help=
"Directory including circle file")
18 parser.addoption(
"--luci_eval_driver",
20 help=
"Path to luci eval driver")
23def pytest_generate_tests(metafunc):
24 list_path = metafunc.config.getoption(
'test_list')
25 tflite_dir = metafunc.config.getoption(
'tflite_dir')
26 circle_dir = metafunc.config.getoption(
'circle_dir')
27 eval_driver_path = metafunc.config.getoption(
'luci_eval_driver')
29 tests_default_tol = []
31 with open(list_path)
as f:
32 contents = [line.rstrip()
for line
in f]
34 comment_removed = [line
for line
in contents
if not line.startswith(
'#')]
35 newline_removed = [line
for line
in comment_removed
if line.startswith(
'eval(')]
36 test_args = [extract_test_args(line)
for line
in newline_removed]
38 tests_default_tol = [(arg.split()[0], tflite_dir, circle_dir, eval_driver_path)
41 if 'test_name' in metafunc.fixturenames:
42 metafunc.parametrize(
'test_name,tflite_dir,circle_dir,eval_driver_path',