--- id: pytest-rng version: "1.0.0" license: MIT license license_treatment: permissive maintenance: abandoned --- # pytest-rng — Fixtures for seeding tests and making randomness reproducible License: permissive · Maintenance: abandoned · Downloads: 156.3K/mo ## What it is and what it does pytest-rng is a pytest plugin that provides two fixtures—`rng` and `seed`—to make random number generation deterministic and reproducible in tests. The `rng` fixture returns a pre-seeded NumPy RandomState object, while the `seed` fixture provides an integer seed value. Both derive their seeds by hashing the test's node ID combined with an optional salt string, ensuring the same random sequence runs every time unless you explicitly change the salt to test robustness across different seeds. The package depends on numpy and pytest. It was released once on August 8, 2019 and has not been updated since, making it a stable but unmaintained tool. It is most useful for test suites that need reproducible randomness—such as machine learning or numerical computing tests—where you want to verify that random variations don't mask real bugs, yet still want to change seeds periodically to catch seed-dependent failures. Use it for: - Ensure machine learning model tests produce identical results across runs for CI/CD pipelines - Test numerical algorithms with reproducible random inputs while rotating seeds to catch fragile tests - Verify stochastic simulations behave consistently without hardcoding seed values in test code - Generate deterministic test data from random distributions without manual seed management ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides pytest fixtures that make random number generation reproducible across test runs by seeding with deterministic values derived from test node IDs. Yes, if your test suite targets Python 3.5–3.7 and pytest versions from around 2019. The low install friction and permissive license make adoption straightforward. However, if you need modern Python versions or recent pytest support, verify compatibility first or seek an actively maintained alternative, since this package is abandoned. ## Install pip install pytest-rng uv add pytest-rng poetry add pytest-rng ## Installing pytest-rng Before you install: Low install friction with a pure-Python wheel. However, the package is abandoned—last release was August 8, 2019. No recent maintenance or updates, so compatibility with modern pytest or Python versions is unverified. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source projects. Quickstart: pip install pytest-rng # In your test file: import numpy as np def test_example(rng, seed): random_values = rng.uniform(-1, 1, size=3) print(random_values) # Same output every run Requires numpy and pytest as runtime dependencies; requires Python >=3.5. Verify before relying: - Compatibility with pytest versions released after August 2019 and Python 3.8+ - Whether the numpy.random.mtrand.RandomState interface remains stable in current numpy versions - Active maintenance or community forks addressing modern test framework changes ## Package facts - License: MIT license (permissive) - Python support: supports_current - Install friction: low - Maintenance: abandoned - Downloads: 156.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest random seed fixture, reproducible randomness testing, deterministic test rng, numpy random state pytest, seeded random tests, test randomness control, pytest fixture rng, reproducible-testing, pytest-plugin, random-seeding [View on SkillFed](https://skillfed.io/packages/pytest-rng) · [View on PyPI](https://pypi.org/project/pytest-rng/)