Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions backends/cortex_m/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ def pytest_configure(config):
_set_random_seed(seed)


def pytest_collectstart(collector):
"""Reseed before each test module is imported. Model tests that build
calibration data at module scope draw during collection, so seeding only in
``pytest_configure`` would leave their quantization dependent on how many
modules were imported first."""
if not isinstance(collector, pytest.Module):
return
if os.environ.get("TEST_RUNTIME_IS_NOT_OSS", "0") != "1":
_set_random_seed(collector.config._test_seed)


@pytest.fixture(autouse=True)
def set_random_seed(request):
"""Control random numbers in the Cortex-M test suite.
Expand Down
Loading