File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import os
4+ import random
5+
6+ import numpy as np
37import pytest
48
59
610def 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
3940def 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
4754def 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
You can’t perform that action at this time.
0 commit comments