New submission from Alexander Hungenberg <alexander.hungenb...@gmail.com>:

The following testcase will always be marked as passed:

from unittest import TestCase

class BuggyTestCase(TestCase):
    def test_generator(self):
        self.assertTrue(False)
        yield None


It happened to us that someone accidentally made the test method a generator 
function. That error was caught very late, because it always appears to have 
executed correctly.

Maybe an additional check can be introduced in the unittest module, to check if 
a test_ method was executed correctly?

----------
components: Library (Lib)
messages: 373807
nosy: defreng
priority: normal
severity: normal
status: open
title: unittest: Generator test methods will always be marked as passed
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41322>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to