Skip to content

Conversation

brycedrennan
Copy link
Contributor

@brycedrennan brycedrennan commented Apr 10, 2024

Resolves #600

I'm tempted to make it the default behavior but this is safer.

@brycedrennan brycedrennan force-pushed the bd/unique-seed-per-test branch 2 times, most recently from f61a6ea to cdd56f0 Compare April 10, 2024 00:29
Copy link
Member

@adamchainz adamchainz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.

I think we can make it the default behaviour, no option. Otherwise it’s just another thing other users have to learn about and consider activating.

@brycedrennan brycedrennan force-pushed the bd/unique-seed-per-test branch 3 times, most recently from 946b247 to 8b80740 Compare April 10, 2024 17:01
@brycedrennan
Copy link
Contributor Author

It's done but there is an inconsistency with how seeding works with faker. I'm not sure what would be least surprising for someone given the docs from faker.

assert fake.name() == 'Justin Richard'
def test_two():
assert fake.name() == 'Tiffany Williams'
"""
)
out = ourtester.runpytest("--randomly-seed=1")
out.assert_outcomes(passed=2)
def test_faker_fixture(ourtester):
ourtester.makepyfile(
test_one="""
def test_one(faker):
assert faker.name() == 'Ryan Gallagher'
def test_two(faker):
assert faker.name() == 'Ryan Gallagher'

https://faker.readthedocs.io/en/master/pytest-fixtures.html#seeding-configuration

@brycedrennan brycedrennan requested a review from adamchainz April 30, 2024 15:25
@alexandrupatrascu
Copy link

hi folks, any chance this gets merged and released soon?
reason why I'm asking is that I'm running pytest-rerunfailures alongside pytest-randomly and the re-runs use the same seed ID, causing the tests to re-use the same test data and not generate new inputs, hence they keep on failing.

thank you for the help!

@brycedrennan
Copy link
Contributor Author

Sounds like you should change your test to either work with the same seed of data or change the data generator to not generate invalid data? I don't believe the changes proposed here would even help with your situation either way.

@tamird
Copy link

tamird commented May 31, 2024

This would be very useful indeed.

In the meantime I worked around this in my own project using

@pytest.fixture(autouse=True)
# autouse fixtures with leading underscores are ignored. See https://github.com/pytest-dev/pytest/issues/12404.
def emulate_pytest_randomly_pull_request_617(request: pytest.FixtureRequest) -> None:  # noqa: PT004
    # pytest-randomly sets `randomly_seed` to an integer at pytest_configure time. See
    # https://github.com/pytest-dev/pytest-randomly/blob/8a3a241/src/pytest_randomly/__init__.py#L138.
    #
    # We include that integer to preserve the behavior of an explicit `--randomly-seed <int>` flag
    # passed on the command line while also giving each test a unique seed.
    request.config.option.randomly_seed += int(hashlib.sha512(request.node.nodeid.encode()).hexdigest(), base=16)

CHANGELOG.rst Outdated
Changelog
=========

* Add the option ``--randomly-seed-per-test`` to use a different seed for each test.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: The actual switch implemented is called --randomly-dont-seed-per-test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch. that's confusing

@brycedrennan brycedrennan force-pushed the bd/unique-seed-per-test branch 4 times, most recently from 67f6aeb to b73b337 Compare June 27, 2025 01:38
@brycedrennan brycedrennan force-pushed the bd/unique-seed-per-test branch from b73b337 to 5175cc6 Compare June 27, 2025 01:40
@brycedrennan brycedrennan changed the title feature: add the option --randomly-seed-per-test to use a different seed for each test feature: each test starts with a unique seed. --randomly-use-same-seed-per-test for old behavior Jun 27, 2025
@adamchainz
Copy link
Member

Thank you for this @brycedrennan . I have eventually got around to looking at it, and I decided it would be easiest to redo the PR, with you recorded as coauthor, in #687. I went for avoiding an option and updating the tests to expect certain fixed random values.

I think this is a great change, and will be combining it with #686 for a new major release! 🥳

@adamchainz adamchainz closed this Sep 10, 2025
adamchainz added a commit that referenced this pull request Sep 10, 2025
Redo of #617, with my review changes.

Co-authored-by: Bryce <[email protected]>
@brycedrennan
Copy link
Contributor Author

thanks! glad it made it in!

github-merge-queue bot pushed a commit to meltano/meltano that referenced this pull request Sep 15, 2025
Bumps [pytest-randomly](https://github.com/pytest-dev/pytest-randomly)
from 3.16.0 to 4.0.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pytest-dev/pytest-randomly/blob/main/CHANGELOG.rst">pytest-randomly's
changelog</a>.</em></p>
<blockquote>
<h2>4.0.1 (2025-09-12)</h2>
<ul>
<li>
<p>Remove the random state caching, which would grow without bound,
leaking memory in long test runs.
The caching was added to slightly speed up re-using the same (final)
seed, but since the final seed is now different for each test, it has no
effect.</p>
<p><code>PR
[#690](pytest-dev/pytest-randomly#690)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/687&gt;</code>__.</p>
</li>
<li>
<p>Modify Numpy seed restriction, replacing hashing with a modulo
operation.
The extra work to hash is unnecessary now that we generate a final seed
per test with CRC32.
This change saves ~500ns per test when Numpy is installed.</p>
<p><code>PR
[#691](pytest-dev/pytest-randomly#691)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/691&gt;</code>__.</p>
</li>
</ul>
<h2>4.0.0 (2025-09-10)</h2>
<ul>
<li>
<p>Support Python 3.14.</p>
</li>
<li>
<p>Use a different random seed per test, based on the test ID.</p>
<p>This change should mean that tests exercise more random data values
in a given run, and that any randomly-generated identifiers have a lower
chance of collision when stored in a shared resource like a
database.</p>
<p><code>PR
[#687](pytest-dev/pytest-randomly#687)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/687&gt;</code><strong>.
Thanks to Bryce Drennan for the suggestion in <code>Issue
[#600](pytest-dev/pytest-randomly#600)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/600&gt;</code></strong>
and initial implementation in <code>PR
[#617](pytest-dev/pytest-randomly#617)
&lt;https://github.com/pytest-dev/pytest-randomly/pull/617&gt;</code>__.</p>
</li>
<li>
<p>Move from MD5 to CRC32 for hashing test IDs, as it’s 5x faster and we
don’t need cryptographic security.</p>
<p><code>Issue
[#686](pytest-dev/pytest-randomly#686)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/686&gt;</code>__.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/50de0961ad3479901a153a4a89ff58ca7898b550"><code>50de096</code></a>
Version 4.0.1</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/f9406ec4452d05a865ee67b83fed58bc8f914bac"><code>f9406ec</code></a>
Modify Numpy seed restriction (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/691">#691</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/22049aabcd1e19012c878dccd5fb1ad728221331"><code>22049aa</code></a>
Remove the random state caching (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/690">#690</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/ded2e547566368d8751a13bf6b6e6ac8b509caa2"><code>ded2e54</code></a>
Version 4.0.0</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/cb9b86128c9e79284f1bfad0dbd5d4c5427b5dfc"><code>cb9b861</code></a>
Move from MD5 to CRC32 for hashing test IDs (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/688">#688</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/bd697bd670943c54b8d21e713dea58ab92508d08"><code>bd697bd</code></a>
Use a different random seed per test (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/687">#687</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/acadf4684fd12e5e9ca14243167f44b8d302f093"><code>acadf46</code></a>
Generate default seed on demand (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/685">#685</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/f818056fa7933f9f08ff6c5cda0d78ecee14d0af"><code>f818056</code></a>
Support Python 3.14 (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/684">#684</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/456f7877992809b4e152bf3a356c0a4658275fb7"><code>456f787</code></a>
Drop unused import of xdist</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/e00b7822dff8061d26ff2b4bdf9dc1a3ea823092"><code>e00b782</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/682">#682</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pytest-dev/pytest-randomly/compare/3.16.0...4.0.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-randomly&package-manager=uv&previous-version=3.16.0&new-version=4.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
kasium pushed a commit to SAP/flake8-tergeo that referenced this pull request Sep 16, 2025
Bumps [pytest-randomly](https://github.com/pytest-dev/pytest-randomly)
from 3.16.0 to 4.0.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pytest-dev/pytest-randomly/blob/main/CHANGELOG.rst">pytest-randomly's
changelog</a>.</em></p>
<blockquote>
<h2>4.0.1 (2025-09-12)</h2>
<ul>
<li>
<p>Remove the random state caching, which would grow without bound,
leaking memory in long test runs.
The caching was added to slightly speed up re-using the same (final)
seed, but since the final seed is now different for each test, it has no
effect.</p>
<p><code>PR
[#690](pytest-dev/pytest-randomly#690)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/687&gt;</code>__.</p>
</li>
<li>
<p>Modify Numpy seed restriction, replacing hashing with a modulo
operation.
The extra work to hash is unnecessary now that we generate a final seed
per test with CRC32.
This change saves ~500ns per test when Numpy is installed.</p>
<p><code>PR
[#691](pytest-dev/pytest-randomly#691)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/691&gt;</code>__.</p>
</li>
</ul>
<h2>4.0.0 (2025-09-10)</h2>
<ul>
<li>
<p>Support Python 3.14.</p>
</li>
<li>
<p>Use a different random seed per test, based on the test ID.</p>
<p>This change should mean that tests exercise more random data values
in a given run, and that any randomly-generated identifiers have a lower
chance of collision when stored in a shared resource like a
database.</p>
<p><code>PR
[#687](pytest-dev/pytest-randomly#687)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/687&gt;</code><strong>.
Thanks to Bryce Drennan for the suggestion in <code>Issue
[#600](pytest-dev/pytest-randomly#600)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/600&gt;</code></strong>
and initial implementation in <code>PR
[#617](pytest-dev/pytest-randomly#617)
&lt;https://github.com/pytest-dev/pytest-randomly/pull/617&gt;</code>__.</p>
</li>
<li>
<p>Move from MD5 to CRC32 for hashing test IDs, as it’s 5x faster and we
don’t need cryptographic security.</p>
<p><code>Issue
[#686](pytest-dev/pytest-randomly#686)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/686&gt;</code>__.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/50de0961ad3479901a153a4a89ff58ca7898b550"><code>50de096</code></a>
Version 4.0.1</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/f9406ec4452d05a865ee67b83fed58bc8f914bac"><code>f9406ec</code></a>
Modify Numpy seed restriction (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/691">#691</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/22049aabcd1e19012c878dccd5fb1ad728221331"><code>22049aa</code></a>
Remove the random state caching (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/690">#690</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/ded2e547566368d8751a13bf6b6e6ac8b509caa2"><code>ded2e54</code></a>
Version 4.0.0</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/cb9b86128c9e79284f1bfad0dbd5d4c5427b5dfc"><code>cb9b861</code></a>
Move from MD5 to CRC32 for hashing test IDs (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/688">#688</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/bd697bd670943c54b8d21e713dea58ab92508d08"><code>bd697bd</code></a>
Use a different random seed per test (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/687">#687</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/acadf4684fd12e5e9ca14243167f44b8d302f093"><code>acadf46</code></a>
Generate default seed on demand (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/685">#685</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/f818056fa7933f9f08ff6c5cda0d78ecee14d0af"><code>f818056</code></a>
Support Python 3.14 (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/684">#684</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/456f7877992809b4e152bf3a356c0a4658275fb7"><code>456f787</code></a>
Drop unused import of xdist</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/e00b7822dff8061d26ff2b4bdf9dc1a3ea823092"><code>e00b782</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/682">#682</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pytest-dev/pytest-randomly/compare/3.16.0...4.0.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-randomly&package-manager=pip&previous-version=3.16.0&new-version=4.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
kasium pushed a commit to SAP/sqlalchemy-hana that referenced this pull request Sep 16, 2025
Bumps [pytest-randomly](https://github.com/pytest-dev/pytest-randomly)
from 3.16.0 to 4.0.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pytest-dev/pytest-randomly/blob/main/CHANGELOG.rst">pytest-randomly's
changelog</a>.</em></p>
<blockquote>
<h2>4.0.1 (2025-09-12)</h2>
<ul>
<li>
<p>Remove the random state caching, which would grow without bound,
leaking memory in long test runs.
The caching was added to slightly speed up re-using the same (final)
seed, but since the final seed is now different for each test, it has no
effect.</p>
<p><code>PR
[#690](pytest-dev/pytest-randomly#690)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/687&gt;</code>__.</p>
</li>
<li>
<p>Modify Numpy seed restriction, replacing hashing with a modulo
operation.
The extra work to hash is unnecessary now that we generate a final seed
per test with CRC32.
This change saves ~500ns per test when Numpy is installed.</p>
<p><code>PR
[#691](pytest-dev/pytest-randomly#691)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/691&gt;</code>__.</p>
</li>
</ul>
<h2>4.0.0 (2025-09-10)</h2>
<ul>
<li>
<p>Support Python 3.14.</p>
</li>
<li>
<p>Use a different random seed per test, based on the test ID.</p>
<p>This change should mean that tests exercise more random data values
in a given run, and that any randomly-generated identifiers have a lower
chance of collision when stored in a shared resource like a
database.</p>
<p><code>PR
[#687](pytest-dev/pytest-randomly#687)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/687&gt;</code><strong>.
Thanks to Bryce Drennan for the suggestion in <code>Issue
[#600](pytest-dev/pytest-randomly#600)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/600&gt;</code></strong>
and initial implementation in <code>PR
[#617](pytest-dev/pytest-randomly#617)
&lt;https://github.com/pytest-dev/pytest-randomly/pull/617&gt;</code>__.</p>
</li>
<li>
<p>Move from MD5 to CRC32 for hashing test IDs, as it’s 5x faster and we
don’t need cryptographic security.</p>
<p><code>Issue
[#686](pytest-dev/pytest-randomly#686)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/686&gt;</code>__.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/50de0961ad3479901a153a4a89ff58ca7898b550"><code>50de096</code></a>
Version 4.0.1</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/f9406ec4452d05a865ee67b83fed58bc8f914bac"><code>f9406ec</code></a>
Modify Numpy seed restriction (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/691">#691</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/22049aabcd1e19012c878dccd5fb1ad728221331"><code>22049aa</code></a>
Remove the random state caching (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/690">#690</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/ded2e547566368d8751a13bf6b6e6ac8b509caa2"><code>ded2e54</code></a>
Version 4.0.0</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/cb9b86128c9e79284f1bfad0dbd5d4c5427b5dfc"><code>cb9b861</code></a>
Move from MD5 to CRC32 for hashing test IDs (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/688">#688</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/bd697bd670943c54b8d21e713dea58ab92508d08"><code>bd697bd</code></a>
Use a different random seed per test (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/687">#687</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/acadf4684fd12e5e9ca14243167f44b8d302f093"><code>acadf46</code></a>
Generate default seed on demand (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/685">#685</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/f818056fa7933f9f08ff6c5cda0d78ecee14d0af"><code>f818056</code></a>
Support Python 3.14 (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/684">#684</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/456f7877992809b4e152bf3a356c0a4658275fb7"><code>456f787</code></a>
Drop unused import of xdist</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/e00b7822dff8061d26ff2b4bdf9dc1a3ea823092"><code>e00b782</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/682">#682</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pytest-dev/pytest-randomly/compare/3.16.0...4.0.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-randomly&package-manager=pip&previous-version=3.16.0&new-version=4.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
ekampf pushed a commit to Twingate/kubernetes-operator that referenced this pull request Sep 16, 2025
Bumps [pytest-randomly](https://github.com/pytest-dev/pytest-randomly)
from 3.16.0 to 4.0.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pytest-dev/pytest-randomly/blob/main/CHANGELOG.rst">pytest-randomly's
changelog</a>.</em></p>
<blockquote>
<h2>4.0.1 (2025-09-12)</h2>
<ul>
<li>
<p>Remove the random state caching, which would grow without bound,
leaking memory in long test runs.
The caching was added to slightly speed up re-using the same (final)
seed, but since the final seed is now different for each test, it has no
effect.</p>
<p><code>PR
[#690](pytest-dev/pytest-randomly#690)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/687&gt;</code>__.</p>
</li>
<li>
<p>Modify Numpy seed restriction, replacing hashing with a modulo
operation.
The extra work to hash is unnecessary now that we generate a final seed
per test with CRC32.
This change saves ~500ns per test when Numpy is installed.</p>
<p><code>PR
[#691](pytest-dev/pytest-randomly#691)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/691&gt;</code>__.</p>
</li>
</ul>
<h2>4.0.0 (2025-09-10)</h2>
<ul>
<li>
<p>Support Python 3.14.</p>
</li>
<li>
<p>Use a different random seed per test, based on the test ID.</p>
<p>This change should mean that tests exercise more random data values
in a given run, and that any randomly-generated identifiers have a lower
chance of collision when stored in a shared resource like a
database.</p>
<p><code>PR
[#687](pytest-dev/pytest-randomly#687)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/687&gt;</code><strong>.
Thanks to Bryce Drennan for the suggestion in <code>Issue
[#600](pytest-dev/pytest-randomly#600)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/600&gt;</code></strong>
and initial implementation in <code>PR
[#617](pytest-dev/pytest-randomly#617)
&lt;https://github.com/pytest-dev/pytest-randomly/pull/617&gt;</code>__.</p>
</li>
<li>
<p>Move from MD5 to CRC32 for hashing test IDs, as it’s 5x faster and we
don’t need cryptographic security.</p>
<p><code>Issue
[#686](pytest-dev/pytest-randomly#686)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/686&gt;</code>__.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/50de0961ad3479901a153a4a89ff58ca7898b550"><code>50de096</code></a>
Version 4.0.1</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/f9406ec4452d05a865ee67b83fed58bc8f914bac"><code>f9406ec</code></a>
Modify Numpy seed restriction (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/691">#691</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/22049aabcd1e19012c878dccd5fb1ad728221331"><code>22049aa</code></a>
Remove the random state caching (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/690">#690</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/ded2e547566368d8751a13bf6b6e6ac8b509caa2"><code>ded2e54</code></a>
Version 4.0.0</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/cb9b86128c9e79284f1bfad0dbd5d4c5427b5dfc"><code>cb9b861</code></a>
Move from MD5 to CRC32 for hashing test IDs (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/688">#688</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/bd697bd670943c54b8d21e713dea58ab92508d08"><code>bd697bd</code></a>
Use a different random seed per test (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/687">#687</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/acadf4684fd12e5e9ca14243167f44b8d302f093"><code>acadf46</code></a>
Generate default seed on demand (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/685">#685</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/f818056fa7933f9f08ff6c5cda0d78ecee14d0af"><code>f818056</code></a>
Support Python 3.14 (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/684">#684</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/456f7877992809b4e152bf3a356c0a4658275fb7"><code>456f787</code></a>
Drop unused import of xdist</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/e00b7822dff8061d26ff2b4bdf9dc1a3ea823092"><code>e00b782</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/682">#682</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pytest-dev/pytest-randomly/compare/3.16.0...4.0.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-randomly&package-manager=pip&previous-version=3.16.0&new-version=4.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

provide unique seed to each test
5 participants