Git Product home page Git Product logo

Comments (5)

wmetryka avatar wmetryka commented on July 18, 2024

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.

johncuyle avatar johncuyle commented on July 18, 2024

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.

jfoust-zymergen avatar jfoust-zymergen commented on July 18, 2024

Any workaround discovered?

from pytest-dependency.

mrbean-bremen avatar mrbean-bremen commented on July 18, 2024

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.

gulliver-madrid avatar gulliver-madrid commented on July 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.