Skip to content

stdlib: Fix type for unittest.TestProgram module attribute#15559

Merged
brianschubert merged 1 commit intopython:mainfrom
stephenfin:unittest-TestProgram-fixes
Mar 26, 2026
Merged

stdlib: Fix type for unittest.TestProgram module attribute#15559
brianschubert merged 1 commit intopython:mainfrom
stephenfin:unittest-TestProgram-fixes

Conversation

@stephenfin
Copy link
Copy Markdown
Contributor

This was typed as being a module, string or None. However, while TestProgram accepts a string value for the module parameter, this will always be resolved to a module before being stored [1]. The attribute should therefore be either a module or None.

[1] https://github.com/python/cpython/blob/v3.9.0/Lib/unittest/main.py#L69-L72

This was typed as being a module, string or None. However, while
TestProgram accepts a string value for the module parameter, this will
always be resolved to a module before being stored [1]. The attribute
should therefore be either a module or None.

[1] https://github.com/python/cpython/blob/v3.9.0/Lib/unittest/main.py#L69-L72

Signed-off-by: Stephen Finucane <stephen@that.guru>
Copy link
Copy Markdown
Collaborator

@brianschubert brianschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@brianschubert brianschubert merged commit 07f0b07 into python:main Mar 26, 2026
51 checks passed
@stephenfin stephenfin deleted the unittest-TestProgram-fixes branch March 26, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants