[issue31604] unittest.TestLoader().loadTestsFromTestCase(...) fails when adding test cases with the expectedFailure decorator

Irit Katriel report at bugs.python.org
Mon May 10 12:21:47 EDT 2021


Irit Katriel <iritkatriel at yahoo.com> added the comment:

I can't reproduce the issue on 3.10, I believe it was fixed by this: 

https://github.com/python/cpython/commit/c9b3ef2df06818f055e555c1d23e3ff2d5bf2d74

in particular:

- def expectedFailure(func):
-     @functools.wraps(func)
-     def wrapper(*args, **kwargs):
-         try:
-             func(*args, **kwargs)
-         except Exception:
-             raise _ExpectedFailure(sys.exc_info())
-         raise _UnexpectedSuccess
-     return wrapper
+ def expectedFailure(test_item):
+     test_item.__unittest_expecting_failure__ = True
+     return test_item


2.7 won't be fixed, so closing.

----------
nosy: +iritkatriel
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31604>
_______________________________________


More information about the Python-bugs-list mailing list