Comments (2)
No, currently there is no such option. To be honest, I don't know how such an option should look like.
If I understand you correctly, you have a large test suite and you only want to run a subset of the tests. But some of the selected tests depend on other tests that are not in the selection, so these tests get skipped, because their dependencies have not been run. What I could imagine would be to add a global option ignore_unknown_dependency
. If set to False
, the default, a test will be skipped unless all the dependencies have been run successful. This is the current behavior. But if this option is set to True
, a test will be skipped if any of the dependencies has been skipped or failed. E.g. this would ignore any dependencies that have not been run at all. Would that suit your use case?
from pytest-dependency.
Yes, you understood correctly, the subset of tests is skipped, because it's dependencies have not been run at all.
That option is exactly what would solve this.
If False
test is run if:
- All dependencies have been run
- All dependencies have been run successfully
If True
test is run if:
- Dependencies that have been run were successful.
Dependencies that are not recognized and have not been run at all are ignored.
I will add an example. If I have this code:
import pytest
import pytest_dependency
def test_AAA():
assert 0
@pytest.mark.dependency(depends=["test_AAA"])
def test_BBB1():
pass
@pytest.mark.dependency(depends=["test_BBB1"])
def test_BBB2():
pass
For pytest -v
everything works great and output is:
test_basics.py::test_AAA FAILED
test_basics.py::test_BBB1 SKIPPED
test_basics.py::test_BBB2 SKIPPED
For pytest -v -k BBB
is output:
test_basics.py::test_BBB1 SKIPPED
test_basics.py::test_BBB2 SKIPPED
But test_BBB1 is skipped only because test_AAA have not been run at all.
With an option it may look like this: pytest -v -k BBB -ignore_unknown_dependency True
gives:
test_basics.py::test_BBB1 PASSED
test_basics.py::test_BBB2 PASSED
Dependency on test_AAA is ignored because it has not been run and all tests passed
from pytest-dependency.
Related Issues (20)
- Test suite incompatibility with pytest 6.2 HOT 2
- Tests skipped on linux(3.6.13)(with no test failed) but executing on windows(3.6.10) HOT 3
- Dependency between two tests HOT 1
- session scope not working HOT 1
- Depends on all test methods in class HOT 1
- Conditional dependency on 2 tests HOT 2
- 0.5.1: pytest is failing HOT 4
- Is ordering on fixtures supported?
- only test_b is passed when install pytest-xdist with n>2.
- Not skipping a test when parent test skips or xfails
- The test was skipped,although the dependency test is success. HOT 5
- Dependency call is skipped by executing test with mark HOT 3
- pytest dependency not skipping the dependent tests when failed HOT 3
- when the dependency case use @pytest.mark.parametrize, depened cases was skipped,although the dependency test is success HOT 1
- is @pytest.mark.dependency() can be used for class level? like API test class depends on BVT test class...
- pyproject.toml missing
- Inheriting from test class with dependencies doesn't work correctly HOT 1
- Is pytest-dependency suppose to tell me why a test was skipped? I see nothing in the output explaining why. HOT 1
- Rerunning skipped cases when the parent test fails
- 0.6.0: pep517 based build fails with `Invalid version: 'UNKNOWN'` error message HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-dependency.