Skip to content

fix: support TerminalReporter.isatty being called #13462

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

Merged
merged 1 commit into from
Jun 2, 2025

Conversation

not-my-profile
Copy link
Contributor

Fixes #13461.

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

Outside impact is unclear as others may be using the api as is

We may need to introduce a bool wrapper that support direct checks and calling to obtain the underlying boolean

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jun 2, 2025
@not-my-profile not-my-profile force-pushed the fix-isatty branch 3 times, most recently from 18b5524 to 8a0687a Compare June 2, 2025 07:55
@not-my-profile not-my-profile changed the title fix: change TerminalReporter.isatty to be a method fix: support TerminalReporter.isatty being called Jun 2, 2025
def __init__(self, value: bool):
self._value = value

def __bool__(self):
Copy link
Member

Choose a reason for hiding this comment

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

Do we Want to plan for a evenual deprecation of the non call variant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you mean by issuing a warning when it's used?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the churn to plugin authors is worth it, given the support code is small.

But we definitely only want to advertise/document the method variant, of course.

@not-my-profile not-my-profile force-pushed the fix-isatty branch 3 times, most recently from 9b1085c to 3af5c0a Compare June 2, 2025 08:49
@nicoddemus nicoddemus merged commit cba5c4a into pytest-dev:main Jun 2, 2025
31 checks passed
Copy link

patchback bot commented Jun 2, 2025

Backport to 8.3.x: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply cba5c4a on top of patchback/backports/8.3.x/cba5c4a98f65fdcfa484749bc06bcde1fb0865bc/pr-13462

Backporting merged PR #13462 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/pytest-dev/pytest.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/8.3.x/cba5c4a98f65fdcfa484749bc06bcde1fb0865bc/pr-13462 upstream/8.3.x
  4. Now, cherry-pick PR fix: support TerminalReporter.isatty being called #13462 contents into that branch:
    $ git cherry-pick -x cba5c4a98f65fdcfa484749bc06bcde1fb0865bc
    If it'll yell at you with something like fatal: Commit cba5c4a98f65fdcfa484749bc06bcde1fb0865bc is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x cba5c4a98f65fdcfa484749bc06bcde1fb0865bc
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR fix: support TerminalReporter.isatty being called #13462 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/8.3.x/cba5c4a98f65fdcfa484749bc06bcde1fb0865bc/pr-13462
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@bluetech bluetech added backport 8.4.x apply to PRs at any point; backports the changes to the 8.4.x branch and removed backport 8.4.x apply to PRs at any point; backports the changes to the 8.4.x branch labels Jun 2, 2025
Copy link

patchback bot commented Jun 3, 2025

Backport to 8.4.x: 💚 backport PR created

✅ Backport PR branch: patchback/backports/8.4.x/cba5c4a98f65fdcfa484749bc06bcde1fb0865bc/pr-13462

Backported as #13483

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jun 3, 2025
nicoddemus pushed a commit that referenced this pull request Jun 3, 2025
Fixes #13461.

(cherry picked from commit cba5c4a)

Co-authored-by: Martin Fischer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 8.4.x apply to PRs at any point; backports the changes to the 8.4.x branch bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-o log_cli=true breaks code because of isatty
4 participants