-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
37 lines (30 loc) · 1.29 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
# type: ignore
import os
from biodivine_aeon import BooleanNetwork
# The purpose of this file is to detect tests with `network_file` as input and
# then supply these tests with networks from `bbm-bnet-inputs-true` up to a
# certain network size. This network size can be configured using
# `--networksize` and its default value is 20.
# We intentionally test on the `-inputs-true` models as opposed to `-inputs-identity`,
# as having fixed inputs ensures there are not too many trap spaces, fixed points, etc.
def pytest_addoption(parser):
parser.addoption(
"--networksize",
action="store",
default="20",
help="Only check networks up to this size.",
)
def pytest_generate_tests(metafunc):
if "network_file" in metafunc.fixturenames:
size = int(metafunc.config.getoption("networksize"))
models = []
for model in os.listdir("./models/bbm-bnet-inputs-true"):
if not model.endswith(".bnet"):
# Just in case there are some other files there.
continue
path = f"./models/bbm-bnet-inputs-true/{model}"
bn = BooleanNetwork.from_file(path)
if bn.variable_count() > size:
continue
models.append(path)
metafunc.parametrize("network_file", models)