Comments (3)
I'm not sure whether it's the same problem but I have the following behavior:
import pytest
@pytest.mark.dependency()
@pytest.mark.parametrize("message", ["hello", "world"])
def test_a(message):
print(message)
assert True
@pytest.mark.dependency(depends=["test_a"])
def test_b():
assert True
My output when I run
pytest -rsx tests/test_dep.py
is
========================================================== test session starts ===========================================================
platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/user/pytest_dep_test
plugins: dependency-0.5.1
collected 3 items
tests/test_dep.py ..s [100%]
======================================================== short test summary info =========================================================
SKIPPED [1] ../../../../../../tmp/pytest_dep_venv/lib64/python3.10/site-packages/pytest_dependency.py:103: test_b depends on test_a
====================================================== 2 passed, 1 skipped in 0.01s ======================================================
test_a
will never fail but still test_b
is skipped. In the documentation it says:
In the same way as the pytest.mark.skip() and pytest.mark.xfail() markers, the pytest.mark.dependency() marker may be applied to individual test instances in the case of parametrized tests.
The may be applied sounds optional to me :)
However, when I remove the @pytest.mark.parametrize
like this:
import pytest
@pytest.mark.dependency()
# @pytest.mark.parametrize("message", ["hello", "world"])
# def test_a(message):
def test_a():
assert True
@pytest.mark.dependency(depends=["test_a"])
def test_b():
assert True
it works:
========================================================== test session starts ===========================================================
platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
rootdir: [...]
plugins: dependency-0.5.1
collected 2 items
tests/test_dep.py .. [100%]
=========================================================== 2 passed in 0.00s ============================================================
Also if test_a
will assert False
the correct behavior is acheived (Fs
)!
Python version: 3.10.5
pytest version: 7.1.2
pytest-dependency version: 0.5.1
Thanks for your help!
Best regards
from pytest-dependency.
I'm not sure whether it's the same problem but I have the following behavior:
import pytest @pytest.mark.dependency() @pytest.mark.parametrize("message", ["hello", "world"]) def test_a(message): print(message) assert True @pytest.mark.dependency(depends=["test_a"]) def test_b(): assert TrueMy output when I run
pytest -rsx tests/test_dep.pyis
========================================================== test session starts =========================================================== platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/user/pytest_dep_test plugins: dependency-0.5.1 collected 3 items tests/test_dep.py ..s [100%] ======================================================== short test summary info ========================================================= SKIPPED [1] ../../../../../../tmp/pytest_dep_venv/lib64/python3.10/site-packages/pytest_dependency.py:103: test_b depends on test_a ====================================================== 2 passed, 1 skipped in 0.01s ======================================================
test_a
will never fail but stilltest_b
is skipped. In the documentation it says:In the same way as the pytest.mark.skip() and pytest.mark.xfail() markers, the pytest.mark.dependency() marker may be applied to individual test instances in the case of parametrized tests.
The may be applied sounds optional to me :)
However, when I remove the
@pytest.mark.parametrize
like this:import pytest @pytest.mark.dependency() # @pytest.mark.parametrize("message", ["hello", "world"]) # def test_a(message): def test_a(): assert True @pytest.mark.dependency(depends=["test_a"]) def test_b(): assert Trueit works:
========================================================== test session starts =========================================================== platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0 rootdir: [...] plugins: dependency-0.5.1 collected 2 items tests/test_dep.py .. [100%] =========================================================== 2 passed in 0.00s ============================================================
Also if
test_a
willassert False
the correct behavior is acheived (Fs
)!Python version: 3.10.5 pytest version: 7.1.2 pytest-dependency version: 0.5.1
Thanks for your help!
Best regards
I meet the same problem.
Maybe a turnaround using skipif option ?
from pytest-dependency.
It seems to me that this project is dead... maybe we should move on ;)
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 2
- 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
- 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 HOT 1
- 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.