{ "info": { "author": "Applied Brain Research", "author_email": "info@appliedbrainresearch.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Pytest", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only" ], "description": "**********\npytest-rng\n**********\n\n``pytest-rng`` provides fixtures for\nensuring \"randomness\" in your tests is reproducible\nfrom one run to the next.\nIt also allows the seed for all tests to be changed if requested,\nto help ensure that test successes are not dependent on\nparticular random number seeds.\n\n- Use the ``rng`` fixture to get a pre-seeded random number generator (RNG)\n that exposes NumPy's `~numpy.random.mtrand.RandomState` interface.\n\n- Use the ``seed`` fixture to get an integer seed\n that can be used to initialize your own RNG.\n\nThe following example prints the same four random numbers\nevery time the test is run.\n\n.. code-block:: python\n\n import numpy as np\n\n def test_rectification(rng, seed):\n print(rng.uniform(-1, 1, size=3))\n print(seed)\n\nTo use these fixtures, install with\n\n.. code-block:: bash\n\n pip install pytest-rng\n\nOnce installed, you can use these fixtures like any other fixture:\nadd ``rng`` or ``seed`` to the arguments of a test function or class.\n\nSeed generation\n===============\n\nFor the ``seed`` fixture, we generate a seed by doing the following:\n\n1. Concatenate the test's ``nodeid`` and a ``salt`` value, if provided.\n2. Hash that string to yield an integer seed.\n\nFor the ``rng`` fixture, we also add the string ``\"rng\"`` to the ``salt``\nvalue before generating the seed as above.\nThe seed is used to instantiate a `~numpy.random.mtrand.RandomState`,\nwhich is returned.\n\n.. note:: We add ``\"rng\"`` to the salt to ensure that random numbers\n are different when using the ``rng`` fixture\n and when manually instantiating a ``RandomState``\n with the ``seed`` fixture.\n\nsalt\n====\n\n``salt`` is a string that is added to the test's ``nodeid``\nin order to change the seed for all tests.\nIt is advantageous to change seeds regularly to ensure that\nyour test suite is robust to different seeds.\n\nThe salt value can be specified in a configuration file\nlike ``setup.cfg`` or ``pytest.ini``.\n\n.. code-block:: ini\n\n [tool:pytest]\n\n rng_salt = v0.3.0\n\nThe salt value can also be specified through the command line.\n\n.. code-block:: bash\n\n pytest --rng-salt \"v0.4.0\"\n\nThe salt value passed through the command line takes precedence\nover the value set in the configuration file\nso that you can change seeds on-the-fly.\n\n~~~~~\n\nSee the full\n`documentation `__\nfor more details.\n\n***************\nRelease History\n***************\n\n.. Changelog entries should follow this format:\n\n version (release date)\n ======================\n\n **section**\n\n - One-line description of change (link to Github issue/PR)\n\n.. Changes should be organized in one of several sections:\n\n - Added\n - Changed\n - Deprecated\n - Removed\n - Fixed\n\n1.0.0 (August 8, 2019)\n======================\n\nInitial release of ``pytest-rng``!\nThanks to all of the contributors for making this possible!\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.nengo.ai/pytest-rng", "keywords": "", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "pytest-rng", "package_url": "https://pypi.org/project/pytest-rng/", "platform": "", "project_url": "https://pypi.org/project/pytest-rng/", "project_urls": { "Homepage": "https://www.nengo.ai/pytest-rng" }, "release_url": "https://pypi.org/project/pytest-rng/1.0.0/", "requires_dist": [ "numpy", "pytest", "nengo-sphinx-theme (>=1.0) ; extra == 'all'", "sphinx ; extra == 'all'", "nengo-sphinx-theme (>=1.0) ; extra == 'docs'", "sphinx ; extra == 'docs'" ], "requires_python": ">=3.5", "summary": "Fixtures for seeding tests and making randomness reproducible", "version": "1.0.0" }, "last_serial": 5651912, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "13aa90963c2a02a711dcdd7260e8e447", "sha256": "346e76a34f19c1f70e1059567460df9edf34aa6b41441c8707bf9ed40446b9c7" }, "downloads": -1, "filename": "pytest_rng-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "13aa90963c2a02a711dcdd7260e8e447", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 7992, "upload_time": "2019-08-08T19:25:55", "url": "https://files.pythonhosted.org/packages/ac/66/40c88e87c8731d96bb2f9a49329785d24236debb9685f6aaccc52536e697/pytest_rng-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "da285194851f709b2287e3e824711319", "sha256": "9d9ee96557246756072133ff9b990588f28f12d3e80357cad959ef0b05aed9fa" }, "downloads": -1, "filename": "pytest-rng-1.0.0.tar.gz", "has_sig": false, "md5_digest": "da285194851f709b2287e3e824711319", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 14789, "upload_time": "2019-08-08T19:25:57", "url": "https://files.pythonhosted.org/packages/e1/b7/11c928ffabbb79d86cc120b9b67b74c2ac0d132b3ea19f14024f7f0a0e4c/pytest-rng-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "13aa90963c2a02a711dcdd7260e8e447", "sha256": "346e76a34f19c1f70e1059567460df9edf34aa6b41441c8707bf9ed40446b9c7" }, "downloads": -1, "filename": "pytest_rng-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "13aa90963c2a02a711dcdd7260e8e447", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 7992, "upload_time": "2019-08-08T19:25:55", "url": "https://files.pythonhosted.org/packages/ac/66/40c88e87c8731d96bb2f9a49329785d24236debb9685f6aaccc52536e697/pytest_rng-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "da285194851f709b2287e3e824711319", "sha256": "9d9ee96557246756072133ff9b990588f28f12d3e80357cad959ef0b05aed9fa" }, "downloads": -1, "filename": "pytest-rng-1.0.0.tar.gz", "has_sig": false, "md5_digest": "da285194851f709b2287e3e824711319", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 14789, "upload_time": "2019-08-08T19:25:57", "url": "https://files.pythonhosted.org/packages/e1/b7/11c928ffabbb79d86cc120b9b67b74c2ac0d132b3ea19f14024f7f0a0e4c/pytest-rng-1.0.0.tar.gz" } ] }