-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Dependency between tests #2317
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
Comments
currently its not supported, but its a mechanism thats often needed for system level testing in order to safe time its really hard to do a feature like this properly atm, because we would need to integrate with parameterization and test items correctly - internal refactoring are needed to give this a solid base as for expressing it, my proposal for the initial prototype would be
|
Has there been any movement or work put into making this feature a reality? It'd be extremely helpful for integration/system level testing like you commented before. |
@BlacKCaT27 I don't think anybody is working on this. A workaround I suggest is to name the test functions differently and call them from a proper test. For example: import pytest
def check_foo():
assert False
def check_bar():
assert True
def test_baz():
check_foo()
check_bar() |
Thanks for the rapid reply. That's a great workaround I'll be sure to use. Also, could you confirm something for me? I've noticed (and seen others online mention) that pytest appears to run all tests in a module from top to bottom by default. Is that guaranteed behavior or just a happenstance of how pytest currently discovers tests from a module? |
py.test tries to order based on source location ,but will reshuffle based on fixture scope to avoid unnecessary setup/teardown, |
Ah, clever! Good to know. Thanks!
…On Mon, Jul 24, 2017 at 10:27 AM, Ronny Pfannschmidt < ***@***.***> wrote:
py.test tries to order based on source location ,but will reshuffle based
on fixture scope to avoid unnecessary setup/teardown,
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2317 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE_54UtgDQrK8ycGkuw_k1x9Os5VzhgJks5sRKnvgaJpZM4MgXUo>
.
|
FWIW there's also the pytest-ordering plugin. |
There is a package pytest-dependency that does exactly what you/we want. |
Should we close this? So far we have one workaround and two plugins; IMHO we don't need to integrate this into the core. |
Thanks! |
Is there any way currently to declare some dependency between tests?
In an ideal world, I'd love something like this:
Where
test_baz
would fail because at least one of test it depends on failed (test_foo
).If that doesn't exist yet, would you think it could be a pytest feature? Or a good purpose for a plugin?
The text was updated successfully, but these errors were encountered: