Issue34900
Created on 2018-10-04 22:24 by Bruno Oliveira, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 9707 | merged | python-dev, 2018-10-04 23:27 | |
| PR 9818 | merged | miss-islington, 2018-10-12 10:36 | |
| PR 9819 | merged | miss-islington, 2018-10-12 10:36 | |
| Messages (8) | |||
|---|---|---|---|
| msg327092 - (view) | Author: Bruno Oliveira (Bruno Oliveira) * | Date: 2018-10-04 22:24 | |
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 ``tc.run()`` to ``tc.debug()`` we get the following exception:
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, ``subTest`` assumes that the ``TestCase`` instance has the ``self._outcome`` atribute, which is set only by ``run()``.
|
|||
| msg327115 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2018-10-05 09:30 | |
PR 9707 looks good to me. I will merge it once your CLA is processed by the PSF staff. Thanks! |
|||
| msg327117 - (view) | Author: Bruno Oliveira (Bruno Oliveira) * | Date: 2018-10-05 09:52 | |
Great, thanks again for the quick review. |
|||
| msg327121 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2018-10-05 10:27 | |
FYI, I just noticed that this is a duplicate of issue 29551, but decided to keep this one open. |
|||
| msg327123 - (view) | Author: Bruno Oliveira (Bruno Oliveira) * | Date: 2018-10-05 10:34 | |
> FYI, I just noticed that this is a duplicate of issue 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. |
|||
| msg327577 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2018-10-12 10:36 | |
New changeset da2bf9f66d0c95b988c5d87646d168f65499b316 by Berker Peksag (Bruno Oliveira) in branch 'master': bpo-34900: Make TestCase.debug() work with subtests (GH-9707) https://github.com/python/cpython/commit/da2bf9f66d0c95b988c5d87646d168f65499b316 |
|||
| msg327579 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2018-10-12 11:07 | |
New changeset 7a98e302c37781f9c6448a28bc70bff18b7e2862 by Berker Peksag (Miss Islington (bot)) in branch '3.7': bpo-34900: Make TestCase.debug() work with subtests (GH-9707) https://github.com/python/cpython/commit/7a98e302c37781f9c6448a28bc70bff18b7e2862 |
|||
| msg327580 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2018-10-12 11:07 | |
New changeset c1fe49c01f3850aaa32a7d75e47f90eb5c5f7efe by Berker Peksag (Miss Islington (bot)) in branch '3.6': bpo-34900: Make TestCase.debug() work with subtests (GH-9707) https://github.com/python/cpython/commit/c1fe49c01f3850aaa32a7d75e47f90eb5c5f7efe |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:06 | admin | set | github: 79081 |
| 2019-04-08 16:39:55 | xtreak | link | issue36554 superseder |
| 2018-10-12 11:09:21 | berker.peksag | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-10-12 11:07:48 | berker.peksag | set | messages: + msg327580 |
| 2018-10-12 11:07:06 | berker.peksag | set | messages: + msg327579 |
| 2018-10-12 10:36:15 | miss-islington | set | pull_requests: + pull_request9197 |
| 2018-10-12 10:36:09 | miss-islington | set | pull_requests: + pull_request9196 |
| 2018-10-12 10:36:07 | berker.peksag | set | messages: + msg327577 |
| 2018-10-05 10:34:35 | Bruno Oliveira | set | messages: + msg327123 |
| 2018-10-05 10:29:40 | berker.peksag | link | issue29551 superseder |
| 2018-10-05 10:27:41 | berker.peksag | set | messages: + msg327121 |
| 2018-10-05 09:52:35 | Bruno Oliveira | set | messages: + msg327117 |
| 2018-10-05 09:30:58 | berker.peksag | set | versions:
+ Python 3.8, - Python 3.4, Python 3.5 nosy: + berker.peksag messages: + msg327115 type: crash -> behavior |
| 2018-10-05 03:13:31 | xtreak | set | nosy:
+ xtreak |
| 2018-10-04 23:27:13 | python-dev | set | keywords:
+ patch stage: patch review pull_requests: + pull_request9092 |
| 2018-10-04 22:25:02 | Bruno Oliveira | set | type: crash |
| 2018-10-04 22:24:33 | Bruno Oliveira | create | |