-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
unittest subTests() fails when called from debug() #79081
Comments
Consider this code: import unittest
class TC(unittest.TestCase):
def test_subtest(self):
with self.subTest():
pass
tc = TC('test_subtest')
tc.run() This works when executed, but if we change Traceback (most recent call last):
File ".tmp\test-unittest-regression.py", line 13, in <module>
tc.debug()
File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\unittest\case.py", line 658, in debug
getattr(self, self._testMethodName)()
File ".tmp\test-unittest-regression.py", line 7, in test_subtest
with self.subTest():
File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\contextlib.py", line 81, in __enter__
return next(self.gen)
File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\unittest\case.py", line 512, in subTest
if not self._outcome.result_supports_subtests:
AttributeError: 'NoneType' object has no attribute 'result_supports_subtests' Looking at the code, |
PR 9707 looks good to me. I will merge it once your CLA is processed by the PSF staff. Thanks! |
Great, thanks again for the quick review. |
FYI, I just noticed that this is a duplicate of bpo-29551, but decided to keep this one open. |
OK thanks. I did try to search for open issues before filing this one by using the "subtest result_supports_subtests" terms, as I figured a bug report would include the traceback, that's why I didn't find 29551, heh. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: