{ "info": { "author": "Michon van Dooren", "author_email": "michon1992@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Pytest", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Testing" ], "description": "# pytest-depends\n\nThis pytest plugin allows you to declare dependencies between pytest tests, where dependent tests will not run if the\ntests they depend on did not succeed.\n\nOf course, tests should be self contained whenever possible, but that doesn't mean this doesn't have good uses.\n\nThis can be useful for when the failing of a test means that another test cannot possibly succeed either, especially\nwith slower tests. This isn't a dependency in the sense of test A sets up stuff for test B, but more in the sense of if\ntest A failed there's no reason to bother with test B either.\n\n## Installation\n\nSimply install using `pip` (or `easy_install`):\n\n```\npip install pytest-depends\n```\n\n## Usage\n\n``` python\nBUILD_PATH = 'build'\n\ndef test_build_exists():\n assert os.path.exists(BUILD_PATH)\n\n@pytest.depends(on=['test_build_exists'])\ndef test_build_version():\n result = subprocess.run([BUILD_PATH, '--version', stdout=subprocess.PIPE)\n assert result.returncode == 0\n assert '1.2.3' in result.stdout\n```\n\nThis is a simple example of the situation mentioned earlier. In this case, the first test checks whether the build file\neven exists. If this fails, the other test will not be ran, as there is no point in doing to.\n\n## Order\n\nThis plugin will automatically re-order the tests so that tests are run after the tests they depend on. If another\nplugin also reorders tests (such as `pytest-randomly`), this may cause problems, as dependencies that haven't ran yet\nare considered failures.\n\nThis plugin attempts to make sure it runs last to prevent this issue, but there are no guarantees this is successful. If\nyou run into issues with this in combination with another plugin, feel free to open an issue.\n\n## Naming\n\nThere are multiple ways to refer to each test. Let's start with an example, which we'll call `test_file.py`:\n\n``` python\nclass TestClass(object):\n @pytest.mark.depends(name='foo')\n def test_in_class(self):\n pass\n\n@pytest.mark.depends(name='foo')\ndef test_outside_class():\n pass\n\ndef test_without_name(num):\n pass\n```\n\nThe `test_in_class` test will be available under the following names:\n\n- `test_file.py::TestClass::test_in_class`\n- `test_file.py::TestClass`\n- `test_file.py`\n- `foo`\n\nThe `test_outside_class` test will be available under the following names:\n\n- `test_file.py::test_outside_class`\n- `test_file.py`\n- `foo`\n\nThe `test_without_name` test will be available under the following names:\n\n- `test_file.py::test_without_name`\n- `test_file.py`\n\nNote how some names apply to multiple tests. Depending on `foo` in this case would mean depending on both\n`test_in_class` and `test_outside_class`, and depending on `test_file.py` would mean depending on all 3 tests in this\nfile.\n\nAnother example, with parametrization. We'll call this one `test_params.py`:\n\n``` python\n@pytest.mark.depends(name='bar')\n@pytest.mark.parametrize('num', [\n pytest.param(1, marks=pytest.mark.depends(name='baz')),\n 2,\n])\ndef test_with_params(num):\n pass\n```\n\nThe first run of the test, with `num = 1`, will be available under the following names:\n\n- `test_params.py::test_with_params[num0]`\n- `test_params.py::test_with_params`\n- `test_params.py`\n- `baz`\n\nThe second run of the test, with `num = 2`, will be available under the following names:\n\n- `test_params.py::test_with_params[num1]`\n- `test_params.py::test_with_params`\n- `test_params.py`\n- `bar`\n\nNote that that version that got its own mark with `pytest.depends` doesn't have `bar` as name. This is because this\ncompletely replaces the `depends` mark for this test. If you want it to also have `bar` as name, do the following\ninstead:\n\n``` python\npytest.param(1, marks=pytest.mark.depends(name=['bar', 'baz']))\n```\n\nAlso note that the first name has a partially autogenerated name. If you want to depend on a single instance of a\nparametrized test, it's recommended to use the `pytest.depends` syntax to give it a name rather than depending on the\nautogenerated one.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/maienm/pytest-depends", "keywords": "pytest", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pytest-depends", "package_url": "https://pypi.org/project/pytest-depends/", "platform": "", "project_url": "https://pypi.org/project/pytest-depends/", "project_urls": { "Homepage": "https://gitlab.com/maienm/pytest-depends" }, "release_url": "https://pypi.org/project/pytest-depends/0.8.1/", "requires_dist": [ "colorama", "future-fstrings", "networkx", "pytest (<3.7,>=3)" ], "requires_python": "", "summary": "Tests that depend on other tests", "version": "0.8.1" }, "last_serial": 4158406, "releases": { "0.8.0": [ { "comment_text": "", "digests": { "md5": "7d0e46e97d6239405d8c7a522574c8f9", "sha256": "3de316214f2781e2d5f1df42399086ae5dd53eb18846797dde6d7e2413cc40bd" }, "downloads": -1, "filename": "pytest_depends-0.8.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7d0e46e97d6239405d8c7a522574c8f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8969, "upload_time": "2018-08-10T20:08:13", "url": "https://files.pythonhosted.org/packages/3f/b0/4e11adb5d1a5bfb4045722dff9ef3b73c2434065db74010236f9d655e8c6/pytest_depends-0.8.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5572d033c35d4fdce06c084ec1f54197", "sha256": "41c8fc0f9223e29882ac27c15e25aa334fcc10f74d216f195706244428657935" }, "downloads": -1, "filename": "pytest-depends-0.8.0.tar.gz", "has_sig": false, "md5_digest": "5572d033c35d4fdce06c084ec1f54197", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8151, "upload_time": "2018-08-10T20:08:15", "url": "https://files.pythonhosted.org/packages/cf/91/12ae9ef71cd4a1d289ae6314734e28a2c708fa92c024c7cdf63abd693dbf/pytest-depends-0.8.0.tar.gz" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "69c3b37a41c254d2b6daafbbd5e9de67", "sha256": "28c7326b6c2b00976dc79872e29b5aa920c6e21e152a1201981cbcf7db7e2cc7" }, "downloads": -1, "filename": "pytest_depends-0.8.1-py3-none-any.whl", "has_sig": false, "md5_digest": "69c3b37a41c254d2b6daafbbd5e9de67", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9142, "upload_time": "2018-08-10T21:03:22", "url": "https://files.pythonhosted.org/packages/3e/3f/87147004121b8f94919c0a26f9febfe9751b38deae303b16ed28529d0993/pytest_depends-0.8.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "80e28bf55efa1f8385b7cfec0525f3f2", "sha256": "1c6598db6973a4798773af9ffcd13eb951da58571c00d766dbab6c9df877951a" }, "downloads": -1, "filename": "pytest-depends-0.8.1.tar.gz", "has_sig": false, "md5_digest": "80e28bf55efa1f8385b7cfec0525f3f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8298, "upload_time": "2018-08-10T21:03:24", "url": "https://files.pythonhosted.org/packages/de/dc/7a4073e314920a98eba1ac23b2eca0d207a464a1015dcc69ace79a3b60cf/pytest-depends-0.8.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "69c3b37a41c254d2b6daafbbd5e9de67", "sha256": "28c7326b6c2b00976dc79872e29b5aa920c6e21e152a1201981cbcf7db7e2cc7" }, "downloads": -1, "filename": "pytest_depends-0.8.1-py3-none-any.whl", "has_sig": false, "md5_digest": "69c3b37a41c254d2b6daafbbd5e9de67", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9142, "upload_time": "2018-08-10T21:03:22", "url": "https://files.pythonhosted.org/packages/3e/3f/87147004121b8f94919c0a26f9febfe9751b38deae303b16ed28529d0993/pytest_depends-0.8.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "80e28bf55efa1f8385b7cfec0525f3f2", "sha256": "1c6598db6973a4798773af9ffcd13eb951da58571c00d766dbab6c9df877951a" }, "downloads": -1, "filename": "pytest-depends-0.8.1.tar.gz", "has_sig": false, "md5_digest": "80e28bf55efa1f8385b7cfec0525f3f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8298, "upload_time": "2018-08-10T21:03:24", "url": "https://files.pythonhosted.org/packages/de/dc/7a4073e314920a98eba1ac23b2eca0d207a464a1015dcc69ace79a3b60cf/pytest-depends-0.8.1.tar.gz" } ] }