Reset random.seed() before every test case

This commit is contained in:
Alexander Hess 2024-09-27 16:04:37 +02:00
commit 3d9f990c68
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
3 changed files with 22 additions and 1 deletions

View file

@ -230,11 +230,14 @@ TEST_DEPENDENCIES = (
"packaging",
"pytest",
"pytest-cov",
"pytest-randomly",
"semver",
'typing-extensions; python_version < "3.11"', # to support Python 3.9 & 3.10
"xdoctest",
)
TEST_RANDOM_SEED = "--randomly-seed=42"
@nox.session(python=SUPPORTED_PYTHONS)
def test(session: nox.Session) -> None:
@ -250,6 +253,7 @@ def test(session: nox.Session) -> None:
args = posargs or (
"--cov",
"--no-cov-on-fail",
TEST_RANDOM_SEED,
TESTS_LOCATION,
)
@ -294,6 +298,7 @@ def test_coverage_run(session: nox.Session) -> None:
"run",
"-m",
"pytest",
TEST_RANDOM_SEED,
TESTS_LOCATION,
)