fix: return default value in Config.getoption when option is None#14440
Closed
zons-zhaozhy wants to merge 1 commit intopytest-dev:mainfrom
Closed
fix: return default value in Config.getoption when option is None#14440zons-zhaozhy wants to merge 1 commit intopytest-dev:mainfrom
zons-zhaozhy wants to merge 1 commit intopytest-dev:mainfrom
Conversation
…10558) The default parameter was only checked inside the except AttributeError block. When an option was declared but had a None value (and skip=False), the method returned None directly without ever consulting the default parameter. Fix by checking for default when val is None before returning None. Also update the docstring to reflect that default applies when the option's value is None, not just when undeclared.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
defaultargument toConfig.getoption()was never returnedwhen the option value was
None. The method returnedNonedirectlywithout checking the
defaultparameter.Fix: when
val is None, checkdefaultfirst before returning None.Fixes #10558