Don't break into pdb when raise unittest.SkipTest() appears top-level in a file#10383
Conversation
| if not isinstance(call.excinfo.value, unittest.SkipTest): | ||
| _enter_pdb(node, call.excinfo, report) |
There was a problem hiding this comment.
Can you add a test that we still do enter pdb if unittest.SkipTest is raised within a test function?
There was a problem hiding this comment.
Do you think we should enter pdb in that case? I would argue we shouldn't.
There was a problem hiding this comment.
And thanks for promptly reviewing this PR :)
There was a problem hiding this comment.
From the python docs:
Skipping a test is simply a matter of using the skip() decorator or one of its conditional variants, calling TestCase.skipTest() within a setUp() or test method, or raising SkipTest directly.
If those three actions are functionally equivalent, and we don't break into pdb for the skip() decorator, then it seems like we shouldn't break into pdb for raising SkipTest.
There was a problem hiding this comment.
Oops, yep, skipping both is consistent with the behavior of pytest.skip() too. Merging 🚀
|
Thanks @Zac-HD! |
Closes #10382
Don't break into pdb when
raise unittest.SkipTest()appears top-level in a file.I attempted to follow the instructions here. Please let me know if I missed anything.
I can't run the pytests directly, so let's see what CI says once I open this PR. Both the
pipandtoxinstructions fail with aminversionerror:tox error
I verified the undesirable behavior is remedied when I install via
python3 setup.py developand test a minimal repro file as documented in the original bug ticket.