Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not working, in case of using pytest.mark.parametrize alongside with dependency! #45

Closed
rkahani opened this issue Jun 30, 2020 · 2 comments
Labels
invalid This doesn't seem right

Comments

@rkahani
Copy link

rkahani commented Jun 30, 2020

test_b will always be skipped!

import pytest


class Tests:
    @pytest.mark.dependency()
    @pytest.mark.parametrize('x', [1, 2, 3])
    def test_a(self, x):
        assert True

    @pytest.mark.dependency(depends=["Tests::test_a"])
    def test_b(self):
        assert True

python3 -m pytest -rvAt temp/
============================================================================ test session starts ============================================================================
platform linux -- Python 3.6.9, pytest-5.4.3, py-1.8.1, pluggy-0.13.1
rootdir: /workspace
plugins: reportlog-0.1.1, dependency-0.5.1
collected 4 items

temp/test_x.py ...s [100%]

================================================================================== PASSES ===================================================================================
========================================================================== short test summary info ==========================================================================
PASSED temp/test_x.py::Tests::test_a[1]
PASSED temp/test_x.py::Tests::test_a[2]
PASSED temp/test_x.py::Tests::test_a[3]
SKIPPED [1] /usr/local/lib/python3.6/dist-packages/pytest_dependency.py:103: test_b depends on Tests::test_a

@RKrahl
Copy link
Owner

RKrahl commented Jun 30, 2020

Of course test_b will always be skipped!

Tests::test_b has been marked to depend on Tests::test_a. That means, it will be skipped unless Tests::test_a has been run successfully. As you can see in the output you cite, you have four tests: Tests::test_a[1], Tests::test_a[2], Tests::test_a[3], and Tests::test_b, but no Tests::test_a.

@rkahani
Copy link
Author

rkahani commented Jul 2, 2020

Thanks for the answer,

So it can't find the dependency named Tests::test_a,
I believe printing a warning would be helpful in these cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants