forked from ALIGN-analoglayout/ALIGN-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
58 lines (51 loc) · 2.46 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pytest
from align.utils import logmanager
logmanager.reconfigure_loglevels(console_level='WARNING')
def pytest_addoption(parser):
parser.addoption(
"--runnightly", action="store_true", default=False, help="run nightly tests"
)
parser.addoption(
"--runregression", action="store_true", default=False, help="run regression tests"
)
parser.addoption(
"--maxerrors", type=int, help="Maximum number of circuit errors to tolerate (Use with --runnightly)", default=0
)
parser.addoption(
"--router_mode", type=str, help="Router mode for nightly run (Use with --runnightly)", default='top_down'
)
parser.addoption(
"--skipGDS", action="store_true", default=False, help="Skip GDS for nightly run (Use with --runnightly)"
)
parser.addoption(
"--placer_sa_iterations", type=int, default=10000, help="Set the number of SA iterations for the placer (Use with --runnightly)"
)
parser.addoption(
"--nvariants", type=int, default=1, help="Number of placements candidates to (attempt to) generate (Use with --runnightly)"
)
def pytest_collection_modifyitems(config, items):
if not config.getoption("--runnightly"):
skip_nightly = pytest.mark.skip(reason="need --runnightly option to run")
for item in items:
if "nightly" in item.keywords:
item.add_marker(skip_nightly)
if not config.getoption("--runregression"):
skip_regression = pytest.mark.skip(reason="need --runregression option to run")
for item in items:
if "regression" in item.keywords:
item.add_marker(skip_regression)
def pytest_generate_tests(metafunc):
if "maxerrors" in metafunc.fixturenames:
maxerrors = metafunc.config.getoption("--maxerrors")
metafunc.parametrize("maxerrors", [maxerrors])
if "router_mode" in metafunc.fixturenames:
router_mode = metafunc.config.getoption("--router_mode")
metafunc.parametrize("router_mode", [router_mode])
if "skipGDS" in metafunc.fixturenames:
metafunc.parametrize("skipGDS", [True])
if "placer_sa_iterations" in metafunc.fixturenames:
placer_sa_iterations = metafunc.config.getoption("--placer_sa_iterations")
metafunc.parametrize("placer_sa_iterations", [placer_sa_iterations])
if "nvariants" in metafunc.fixturenames:
nvariants = metafunc.config.getoption("--nvariants")
metafunc.parametrize("nvariants", [nvariants])