Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-135237: fix setUp/tearDown of _colorize.can_colorize in test_argparse#135238

Closed
tpburns wants to merge 1 commit into
python:mainpython/cpython:mainfrom
tpburns:argparseCanColorizeSafetytpburns/cpython:argparseCanColorizeSafetyCopy head branch name to clipboard
Closed

gh-135237: fix setUp/tearDown of _colorize.can_colorize in test_argparse#135238
tpburns wants to merge 1 commit into
python:mainpython/cpython:mainfrom
tpburns:argparseCanColorizeSafetytpburns/cpython:argparseCanColorizeSafetyCopy head branch name to clipboard

Conversation

@tpburns

@tpburns tpburns commented Jun 7, 2025

Copy link
Copy Markdown
Contributor

See test_regrtest TestColorized and test_pdb PdbTestColorize for similar tests with safe setups.

with unittest.mock.patch(
"_colorize.can_colorize", return_value=True
):
result = results.get_state(fail_env_changed=False)

cpython/Lib/test/test_pdb.py

Lines 4694 to 4701 in 24069fb

def setUp(self):
self._original_can_colorize = _colorize.can_colorize
# Force colorize to be enabled because we are sending data
# to a StringIO
_colorize.can_colorize = lambda *args, **kwargs: True
def tearDown(self):
_colorize.can_colorize = self._original_can_colorize

@picnixz picnixz changed the title gh-135237 Add tearDown for _colorize.can_colorize modification in test_argparse gh-135237: Add tearDown for _colorize.can_colorize modification in test_argparse Jun 7, 2025
@sobolevn sobolevn added the needs backport to 3.14 bugs and security fixes label Jun 7, 2025
@sobolevn sobolevn removed the needs backport to 3.14 bugs and security fixes label Jun 7, 2025
@picnixz picnixz changed the title gh-135237: Add tearDown for _colorize.can_colorize modification in test_argparse gh-135237: fix setUp/tearDown of _colorize.can_colorize in test_argparse Jun 7, 2025
@ZeroIntensity ZeroIntensity added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 7, 2025
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit e27c90b 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F135238%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 7, 2025

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Buildbot failures are unrelated

@hugovk

hugovk commented Oct 12, 2025

Copy link
Copy Markdown
Member

Closing re: #135237 (comment)

Thanks anyway!

@hugovk hugovk closed this Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.