Comments (5)
I'm having the same issue. I've used this plugin successfuly in the past, but on my current setup it just skips every test that depends on another.
Code sample:
@pytest.mark.dependency()
def test_ping_host(host):
"""Pinging provided host."""
try:
response = requests.get(host)
except (urllib3.exceptions.MaxRetryError, requests.exceptions.ConnectionError):
raise AssertionError("Host didn't respond.")
assert response is not None
@pytest.mark.dependency(depends=['test_ping_host'])
def test_authentication(user_auth):
"""Asserting that user authentication in conftest was successful."""
# Checking for error key in the authenticate_user object; it existing implies authentication failed
assert not user_auth.get("error")
# Checking to make sure a proper token was returned by our auth function in conftest
assert user_auth.get("token") is not ""
(venv) PS C:\Users\wmetr\Documents\xxx\pytest_demo> pytest ../pytest_demo/ --host http://127.0.0.1:5000
================================================================ test session starts =================================================================
platform win32 -- Python 3.8.0, pytest-7.1.1, pluggy-1.0.0
rootdir: C:\Users\wmetr\Documents\xxx\pytest_demo
plugins: dependency-0.5.1
collected 2 items
test_sample.py .s [100%]
============================================================ 1 passed, 1 skipped in 0.06s ============================================================```
from pytest-dependency.
I'm also seeing this issue.
testsuite/v1/login_test.py::TestIdentifier::test_login_help[edge_driver] PASSED testsuite/v1/login_test.py::TestIdentifier::test_login_with_security_device[edge_driver] PASSED testsuite/v1/login_test.py::TestIdentifier::test_unregistered_email[edge_driver] PASSED testsuite/v1/login_test.py::TestIdentifier::test_invalid_email[edge_driver] PASSED testsuite/v1/login_test.py::TestIdentifier::test_input_email_enter[edge_driver] PASSED testsuite/v1/login_test.py::TestIdentifier::test_input_email_click_next[edge_driver] PASSED testsuite/v1/login_test.py::TestIdentifier::test_input_email_tab_enter_next[edge_driver] PASSED testsuite/v1/login_test.py::TestPassword::test_login_help[edge_driver] PASSED testsuite/v1/login_test.py::TestPassword::test_login_with_security_device[edge_driver] PASSED testsuite/v1/login_test.py::TestPassword::test_invalid_password_enter[edge_driver] SKIPPED (test_invalid_password_enter[edge_driver] depends on TestIdentifier::test_input_email_enter) testsuite/v1/login_test.py::TestPassword::test_input_password_enter[edge_driver] SKIPPED (test_input_password_enter[edge_driver] depends on TestIdentifier::test_input_email_enter) testsuite/v1/login_test.py::TestPassword::test_input_password_click_login[edge_driver] SKIPPED (test_input_password_click_login[edge_driver] depends on TestIdentifier::test_input_email_enter) testsuite/v1/login_test.py::TestPassword::test_input_password_tab_enter_login[edge_driver] SKIPPED (test_input_password_tab_enter_login[edge_driver] depends on TestIdentifier::test_input_email_enter) testsuite/v1/login_test.py::TestPassword::test_input_password_tab_enter_cancel[edge_driver] SKIPPED (test_input_password_tab_enter_cancel[edge_driver] depends on TestIdentifier::test_input_email_enter)
from pytest-dependency.
Any workaround discovered?
from pytest-dependency.
I just had a look at these (as this issue has been mentioned to me elsewhere), and saw that the original issue by @jianchao00 behaves as expected: the tests have only been run for the second test module (test_mod_02), and they are skipped because they depend on tests that have not been run.
The third example by @johncuyle has not enough information about the tests and how they have been run.
The second example by @wmetryka is weird though - I tried to reproduce it without success; this is a trivial case that has always worked, and I suspect something is different in the environment, but I have no idea what it is. @wmetryka: have you resolved this? Maybe you can point to a repo where this happens?
from pytest-dependency.
I had the issue of dependant tests being skipped always, but only when their module name was alphabetically before their dependencies. Solved using pytest-order plugin with the flag --order-dependencies.
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
- 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 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.