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

Flag to run test only if dependent test was successful #17

Open
Ghost93 opened this issue Feb 21, 2023 · 2 comments
Open

Flag to run test only if dependent test was successful #17

Ghost93 opened this issue Feb 21, 2023 · 2 comments

Comments

@Ghost93
Copy link

Ghost93 commented Feb 21, 2023

We have order, but I want to run test 2 only if test 1 was successful (for instance, in my case running test2 is meaningless, should automatically fail)

@Zitrax
Copy link
Owner

Zitrax commented Feb 21, 2023

If I understand you correctly that should already be in place. If you set a test dependency the depending test would not run if the dependency failed.

I haven't worked on this project in several years, but if you have a problem can you provide an example that reproduce the problem?

@Ghost93
Copy link
Author

Ghost93 commented Feb 22, 2023

Hi
Unfortunately it does run the test. Here's a brief example:

some_value = None

def test_1():
    # some logic here
    assert success, "Test should succeed"
    global some_value
    some_value = success.get_value_to_be_used_in_later_tests()

@depends(after=test_1)
def test_2():
    global some_value
    if not some_value:
         assert False, 'some_value must be set by test_1() before running this test
    # use some_value here in test_2
         

And in my case test_2 is running after the failed test_1 and fails because some_value isn't set.
What I'd like to achieve is the test runner not even attempt to run test_2 so I can remove the check if the value has been set

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

No branches or pull requests

2 participants