This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Bruno Oliveira
Recipients Bruno Oliveira
Date 2018-10-04.22:24:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Consider this code:

    import unittest

    class TC(unittest.TestCase):

        def test_subtest(self):
            with self.subTest():

    tc = TC('test_subtest')

This works when executed, but if we change ```` to ``tc.debug()`` we get the following exception:    

    Traceback (most recent call last):
      File ".tmp\", line 13, in <module>
      File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\unittest\", line 658, in debug
        getattr(self, self._testMethodName)()
      File ".tmp\", line 7, in test_subtest
        with self.subTest():
      File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\", line 81, in __enter__
        return next(self.gen)
      File "C:\Users\Bruno\AppData\Local\Programs\Python\Python36\lib\unittest\", 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()``.
Date User Action Args
2018-10-04 22:24:33Bruno Oliveirasetrecipients: + Bruno Oliveira
2018-10-04 22:24:33Bruno Oliveirasetmessageid: <>
2018-10-04 22:24:33Bruno Oliveiralinkissue34900 messages
2018-10-04 22:24:33Bruno Oliveiracreate