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

Add a configuration switch to automatically mark all tests #7

Closed
azmeuk opened this issue Jul 20, 2017 · 3 comments
Closed

Add a configuration switch to automatically mark all tests #7

azmeuk opened this issue Jul 20, 2017 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@azmeuk
Copy link

azmeuk commented Jul 20, 2017

The current documentation describe this usecase:

@pytest.mark.dependency()
def test_a():
    pass

@pytest.mark.dependency(depends=["test_a"])
def test_b():
    pass

It would be great to avoid marking test_a:

def test_a():
    pass

@pytest.mark.dependency(depends=["test_a"])
def test_b():
    pass

What do you think?

@RKrahl
Copy link
Owner

RKrahl commented Jul 20, 2017

This won't work, I'm afraid. The problem is that I need to record the outcome of test_a so that the dependency marker for test_b can check this result and decide whether to skip or not to skip test_b. The marker does just this: recording the outcome of the respective test in the internal structures of pytest-dependency. So I need it also on test_a.

@RKrahl RKrahl added the enhancement New feature or request label Jul 20, 2017
@RKrahl RKrahl added this to the 0.3 milestone Aug 28, 2017
@RKrahl
Copy link
Owner

RKrahl commented Nov 27, 2017

Sorry, my last comment was wrong. It could be implemented as you suggest.

However, I don't like this behavior to be the default. I'd prefer to have the dependencies explicitly be marked. Furthermore, this behavior would mean that internal data structures of pytest get modified even for packages that don't even use pytest-dependency, if only pytest-dependency is installed.

I will rather add a configuration switch automark_dependency to be set in the ini file. If set to False, the default, the current behavior will be retained, e.g. dependencies will need to be marked explicitly. If set to True, it will have the same effect as if all test are implicitly decorated with @pytest.mark.dependency().

@RKrahl RKrahl changed the title Avoid marking dependencies Add a configuration switch to automatically mark all tests Nov 27, 2017
@azmeuk
Copy link
Author

azmeuk commented Nov 27, 2017

The switch would be a pretty good solution indeed!

@RKrahl RKrahl closed this as completed in fd812de Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants