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

Fix issue #9 - parameterization of dependency tests #33

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

GalOz666
Copy link

@GalOz666 GalOz666 commented Mar 9, 2019

Instead of using a helper function or a parameter - the original name of the node will be kept in the list of tests to check when using the depend=[] feature. If the function fails at one of its parameterized runs the node will remain in a failed state. Should there not be any parameterization there will not be any duplicate to check.

@GalOz666
Copy link
Author

GalOz666 commented Mar 9, 2019

The failed test seems to be related to a change in Pytest between some versions where it will say "SKIP" and newer versions will say SKIPPED. Everything works fine - it seems to be more of an issue with the test then with the PR.

@RKrahl
Copy link
Owner

RKrahl commented Mar 9, 2019

Yes, the issue with "SKIP" versus "SKIPPED" is a change in pytest 4.2.0 that causes test_03_skipmsgs.py to fail. I already did notice that, but I didn't got around to fix it yet. At least, I opened an issue now, see #34.

@GalOz666 GalOz666 closed this Mar 9, 2019
@GalOz666
Copy link
Author

GalOz666 commented Mar 9, 2019

sounds good. I am still having issues with this so I will continue working and reopen this

@RKrahl
Copy link
Owner

RKrahl commented Mar 9, 2019

Btw, I didn't had a detailed look into what you are trying to do in DependencyManager.addResult() and I'm afraid, I won't have the time to do so right now. But if it results in a semantic change in what is considered the dependency, something like depending on all parametrized test instances at once, I'm not sure I will be happy with that. I'd rather prefer a resolution of #9 by implementing the helper function sketched there.

@GalOz666
Copy link
Author

GalOz666 commented Mar 9, 2019

Actually , my solution was to add the original name of the node to the results dictionary - such that you can reference it in depends and also reference the name of the nodes with parameters (eg., node[param, param] ) without interruption within the same module.

the only bug is that I need to fix (i think I just did) to make sure that one failure of the original-name node will STICK and never update as PASSED during the module test run.

@GalOz666 GalOz666 reopened this Mar 9, 2019
@GalOz666
Copy link
Author

GalOz666 commented Mar 9, 2019

If you are ok with this - I would write some tests for this in a future PR, with your permission of course.

@RKrahl
Copy link
Owner

RKrahl commented Mar 9, 2019

Interesting idea. I have to think about that. As suggested, I'm somewhat busy right now, so I can't make promises when I will check that in detail.

@GalOz666
Copy link
Author

GalOz666 commented Mar 9, 2019

No problem :) this is mainly for my own project but i think others will benefit as well. A bit hacky but it works fine now ;p

@GalOz666
Copy link
Author

class TestPyDep:

@pytest.mark.dependency(name='smoke')
@pytest.mark.parametrize('nothing', [1, 1, 1])
def test_dep3(self, nothing):
    assert nothing

@pytest.mark.parametrize('nothing', [1, 1])
@pytest.mark.dependency(depends=["smoke"])
def test_two(self, nothing):
    assert nothing

@pytest.mark.parametrize('nothing', [1, 1])
@pytest.mark.dependency(depends=["TestPyDep::test_dep3"])
def test_three(self, nothing):
    assert nothing

^ first five tests (2 first tests) will run - last tests skipped.

class TestPyDep:

@pytest.mark.dependency(name='smoke')
@pytest.mark.parametrize('nothing', [1, 0, 1])
def test_dep3(self, nothing):
    assert nothing

@pytest.mark.parametrize('nothing', [1, 1])
@pytest.mark.dependency(depends=["smoke"])
def test_two(self, nothing):
    assert nothing

@pytest.mark.parametrize('nothing', [1, 1])
@pytest.mark.dependency(depends=["TestPyDep::test_dep3"])
def test_three(self, nothing):
    assert nothing

^ 1 failed, 2 passed, 4 skipped

@DevilXD
Copy link

DevilXD commented May 31, 2020

Is this something that works? Is there a possibility it could be merged?

@GalOz666
Copy link
Author

GalOz666 commented May 31, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants