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

Update showcase tests to assert conditions outside of the context manager. #2100

Closed
ohmayr opened this issue Aug 21, 2024 · 0 comments · Fixed by #2101
Closed

Update showcase tests to assert conditions outside of the context manager. #2100

ohmayr opened this issue Aug 21, 2024 · 0 comments · Fixed by #2101
Assignees

Comments

@ohmayr
Copy link
Contributor

ohmayr commented Aug 21, 2024

The context manager exits immediately as soon as an exception is raised i.e. any following assert statements or code within the with context are not executed. For example, the following test case will pass (even with assert 2 == 3):

def test_dummy():
  with pytest.raises(ValueError) as exc:
      raise ValueError("test")
      assert 2 == 3
      exc.value == "test"  

Therefore, showcase tests need to be updated and the assert statements need to be moved out of the with context to be executed properly. This also exposes a gap in our tests where some of them are incorrectly passing (since the assertion does not occur).

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