Skip to content

Commit 9d653f7

Browse files
committed
tests(unit,fix): fix unit tests relating to updates for PR #307
1 parent 74c9624 commit 9d653f7

3 files changed

Lines changed: 334 additions & 210 deletions

File tree

tests/regression/conftest.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
from __future__ import annotations
22

3+
import os
4+
import random
5+
6+
import numpy as np
37
import pytest
48

59

610
def pytest_addoption(parser: pytest.Parser) -> None:
711
"""
812
Register custom command-line options for pytest.
9-
10-
Adds options to control regression test execution, baseline updates,
11-
and debugging output.
1213
"""
1314
parser.addoption(
1415
"--run-slow",
@@ -38,11 +39,17 @@ def pytest_addoption(parser: pytest.Parser) -> None:
3839

3940
def pytest_configure(config: pytest.Config) -> None:
4041
"""
41-
Register custom pytest markers.
42+
Register markers and enforce deterministic behavior.
4243
"""
4344
config.addinivalue_line("markers", "regression: end-to-end regression tests")
4445
config.addinivalue_line("markers", "slow: long-running tests (20-30+ minutes)")
4546

47+
seed = 0
48+
random.seed(seed)
49+
np.random.seed(seed)
50+
51+
os.environ["PYTHONHASHSEED"] = "0"
52+
4653

4754
def pytest_collection_modifyitems(
4855
config: pytest.Config, items: list[pytest.Item]
@@ -73,7 +80,6 @@ def pytest_collection_modifyitems(
7380
if callspec is not None:
7481
case = callspec.params.get("case")
7582

76-
# Keep non-parametrized tests
7783
if case is None:
7884
filtered_items.append(item)
7985
continue

0 commit comments

Comments
 (0)