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

Fix for Verbose mode not having default value on getoption call works on issue #9422 #12706

Merged
merged 8 commits into from
Sep 5, 2024

Conversation

GTowers1
Copy link
Contributor

@GTowers1 GTowers1 commented Aug 10, 2024

Followed the suggestions on this issue and added a default value to the verbose mode calls as it does in some of the other sections of the code.

Refs #9422

@nicoddemus nicoddemus added skip news used on prs to opt out of the changelog requirement and removed skip news used on prs to opt out of the changelog requirement labels Aug 13, 2024
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Aug 13, 2024
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Thanks @GTowers1.

Since then we have introduced Config.get_verbosity:

def get_verbosity(self, verbosity_type: str | None = None) -> int:

So we should be calling that instead of config.getoption("verbose"). I also noticed that get_verbosity does not handle the possibility of verbose not being defined:

global_level = self.option.verbose

So can you please:

  1. Replace config.getoption("verbose") calls by config.get_verbosity().

  2. Create an integration test in test_config.py that executes a simple test file with the terminal plugin disabled, and ensures pytest finishes with success (0).

  3. Fix Config.get_verbosity so it returns 0 if self.option.verbose is not defined -- basically change self.option.verbose by self.getoption("verbose", 0) here:

    global_level = self.option.verbose

@nicoddemus nicoddemus added the backport 8.3.x apply to PRs at any point; backports the changes to the 8.3.x branch label Aug 30, 2024
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Took the liberty of applying the changes myself. 👍

Will leave this up for a few days to give others a chance to review.

@nicoddemus nicoddemus merged commit 72c682f into pytest-dev:main Sep 5, 2024
28 of 29 checks passed
Copy link

patchback bot commented Sep 5, 2024

Backport to 8.3.x: 💚 backport PR created

✅ Backport PR branch: patchback/backports/8.3.x/72c682ff9773ad2690711105a100423ebf7c7c15/pr-12706

Backported as #12778

🤖 @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 Sep 5, 2024
Instead of calling `Config.option.verbose`, call the new `Config.get_verbosity` function to determine the verbosity level.

This enables pytest to run correctly with the terminal plugin disabled.

Fix #9422

(cherry picked from commit 72c682f)
nicoddemus pushed a commit that referenced this pull request Sep 5, 2024
Instead of calling `Config.option.verbose`, call the new `Config.get_verbosity` function to determine the verbosity level.

This enables pytest to run correctly with the terminal plugin disabled.

Fix #9422

(cherry picked from commit 72c682f)

Co-authored-by: GTowers1 <130098608+GTowers1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 8.3.x apply to PRs at any point; backports the changes to the 8.3.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.

2 participants