Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: Fix TTY test failing on Python 3.14 #709

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

adrienverge
Copy link
Owner

cli: Refactor old test to avoid fcntl

This is a simple preparation for the next commit, to get rid of
low-level fcntl.fcntl() calls, since os.set_blocking() now exists
(since Python 3.5).


cli: Fix TTY test failing on Python 3.14

Since I don't have Python 3.14 on my system (yet), here are the steps I
used to reproduce:

sudo dnf install python3.14
python3.14 -m venv /tmp/py3.14
source /tmp/py3.14/bin/activate
pip install yaml pathspec
python3.14 -m unittest discover
# or
python3.14 -m unittest tests.test_cli.CommandLineTestCase.test_run_default_format_output_in_tty

This commit fixes that by piping only sys.stdout, not sys.stderr
too. I'm not sure why I wrote this code in 2016 (see commit a2c68fd),
but the new one makes more sense to me now.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2336947

This is a simple preparation for the next commit, to get rid of
low-level `fcntl.fcntl()` calls, since `os.set_blocking()` now exists
(since Python 3.5).
Since I don't have Python 3.14 on my system (yet), here are the steps I
used to reproduce:

    sudo dnf install python3.14
    python3.14 -m venv /tmp/py3.14
    source /tmp/py3.14/bin/activate
    pip install yaml pathspec
    python3.14 -m unittest discover
    # or
    python3.14 -m unittest tests.test_cli.CommandLineTestCase.test_run_default_format_output_in_tty

This commit fixes that by piping *only* `sys.stdout`, not `sys.stderr`
too. I'm not sure why I wrote this code in 2016 (see commit a2c68fd),
but the new one makes more sense to me now.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2336947
@coveralls
Copy link

Coverage Status

coverage: 99.824% (-0.001%) from 99.825%
when pulling 025c68c on fix/test_cli-on-python-3.14
into c20f191 on master.

@adrienverge adrienverge merged commit e427005 into master Jan 14, 2025
9 of 14 checks passed
@adrienverge adrienverge deleted the fix/test_cli-on-python-3.14 branch January 14, 2025 07:06
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