Skip to content

Commit 86ebd7b

Browse files
committed
Added STUMPY_SEED support
1 parent 7561ecc commit 86ebd7b

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ def pytest_configure(config):
1313
Called after command line options have been parsed
1414
and all plugins and initial conftest files been loaded.
1515
"""
16-
# rng.set_seed(seed) # Replace this with your failed unit test seed
17-
18-
print(f"conftest.py: rng.set_seed({rng.SEED})")
16+
print(f"STUMPY_SEED={rng.SEED} pixi run tests custom {config.args[0]}")

stumpy/rng.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import os
12
from contextlib import contextmanager
23

34
import numpy as np
45

56
# Note that an initial SEED = 0 is disallowed
67
# in order to account for unit testing
7-
SEED = np.random.randint(1, 4_294_967_296, dtype=np.uint32)
8+
if os.getenv("STUMPY_SEED") is not None: # pragma: no cover
9+
SEED = int(os.getenv("STUMPY_SEED"))
10+
else:
11+
SEED = np.random.randint(1, 4_294_967_296, dtype=np.uint32)
812
RNG = np.random.RandomState(seed=SEED)
913

1014

0 commit comments

Comments
 (0)