gh-120665: make unittest loaders avoid loading test cases that are abstract base classes#120666
Conversation
…are abstract base classes
|
@nedbat I think your comments on https://discuss.python.org/t/unittest-ignore-test-cases-that-are-also-abc/55958/14 suggest an understanding of how this would be a great QoL improvement for test authors. Please help it get merged upstream. |
|
This PR is stale because it has been open for 30 days with no activity. |
|
This seems like such a common-sense enhancement, I'm surprised it's being debated so heavily. The argument that this could break existing code is invalid; existing code that hits this path would already raise an exception and never run. And the intent of Please consider landing this change. |
|
GH-151599 is a backport of this pull request to the 3.13 branch. |
|
GH-151600 is a backport of this pull request to the 3.14 branch. |
|
GH-151601 is a backport of this pull request to the 3.15 branch. |
Make unittest loaders avoid loading test cases that are abstract base classes
Currently, loading a
TestCase-derived subclass that is also an abstract base class like the following:would currently result in:
This PR fixes the error by making the unittest loaders avoid loading such test cases and methods from them.