python / python/cpython

unittest.TestCase is not multiple-inheritance cooperative

Open
#125,252 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

unittest's TestCase does not call super().__init__() which breaks cooperative multiple inheritance.

I would be happy to add this, but I can imagine someone somewhere relies on cooperative multiple inheritance not working.

CPython versions tested on:

3.11, 3.12, 3.13, CPython main branch

Operating systems tested on:

Linux

Linked PRs
  • gh-125287

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with unittest.TestCase initialization and reproduce the cooperative multiple-inheritance case on CPython. Check the behavior across the reported Python versions and identify the relevant unittest tests. Done means TestCase cooperates with multiple inheritance without breaking existing initialization behavior, with a regression test covering the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.