ONE - On-device Neural Engine
Loading...
Searching...
No Matches
conftest.py
Go to the documentation of this file.
1import re
2
3
5 p = re.compile('add\\((.*)\\)')
6 result = p.search(s)
7 return result.group(1)
8
9
10def pytest_addoption(parser):
11 parser.addoption("--test_list", action="store", help="Path to test list")
12 parser.addoption("--bin_dir", action="store", help="Directory including artifacts")
13 parser.addoption("--circle_part_driver",
14 action="store",
15 help="Path to circle part driver")
16
17
19 list_path = metafunc.config.getoption('test_list')
20 bin_dir = metafunc.config.getoption('bin_dir')
21 circle_part_driver = metafunc.config.getoption('circle_part_driver')
22
23 with open(list_path) as f:
24 contents = [line.rstrip() for line in f]
25
26 comment_removed = [line for line in contents if not line.startswith('#')]
27 newline_removed = [line for line in comment_removed if line.startswith('add(')]
28 test_args = [extract_test_args(line) for line in newline_removed]
29 # add(RECIPE_NAME PARTITION_NAME EXPECTED_OUTPUT_COUNT)
30 partition_list = [(arg.split()[1], bin_dir, circle_part_driver) for arg in test_args]
31
32 if 'test_name' in metafunc.fixturenames:
33 metafunc.parametrize('test_name,bin_dir,part_driver_path', partition_list)
pytest_generate_tests(metafunc)
Definition conftest.py:18
pytest_addoption(parser)
Definition conftest.py:10
extract_test_args(s)
Definition conftest.py:4