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

Add --overwrite-ini ININAME=INIVALUE cli option #1667

Merged
merged 1 commit into from
Jun 25, 2016

Conversation

fengxx
Copy link
Contributor

@fengxx fengxx commented Jun 25, 2016

support for "--overwrite-ini ININAME=INIVALUE" to overrides ini values from the command line
so that one can do e.g. "-o xfail_strict=True".

@fengxx
Copy link
Contributor Author

fengxx commented Jun 25, 2016

@blueyed please help review

@The-Compiler
Copy link
Member

Did you check if there are existing commandline options which we now could maybe deprecate?

* New cli flag ``--override-ini`` or ``-o`` that overrides ini values from the
command line so that one can do e.g. "-o xfail_strict=True". This is useful for
specifying options for which there is no separate command-line flag, a complete
ini-options can be showed by py.test --help
Copy link
Contributor

Choose a reason for hiding this comment

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

i'd make a "." after flag. and then say "The complete list of ini-options can be shown by py.test --help". Mind the escape of the command which is important for rendering the docs.

@coveralls
Copy link

coveralls commented Jun 25, 2016

Coverage Status

Coverage increased (+0.009%) to 92.398% when pulling f5a90ab on fengxx:feature/override_ini_option into f2bb3df on pytest-dev:features.

value = None
if self.getoption("override_ini", None):
for ini_config in self.option.override_ini:
(key, user_ini_value) = ini_config.split("=", 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think maxsplit needs to be 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot. Good catch!

@fengxx fengxx force-pushed the feature/override_ini_option branch from f5a90ab to 77104d6 Compare June 25, 2016 14:08
@fengxx
Copy link
Contributor Author

fengxx commented Jun 25, 2016

amended the commit to fix issues

@fengxx fengxx force-pushed the feature/override_ini_option branch from 77104d6 to 18725e6 Compare June 25, 2016 14:13
"ini2:url=/tmp/user2?a=b&d=e",
"ini3:True",
"ini4:False"
])
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we also need a test for multiple -o options -- they all should get applied. So e.g.
-o custom_option1=yes -o custom_option2=no.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rewrited the testcase to use multiple -o

@fengxx fengxx force-pushed the feature/override_ini_option branch 3 times, most recently from 27c77d6 to 9c48bb7 Compare June 25, 2016 14:58
@fengxx
Copy link
Contributor Author

fengxx commented Jun 25, 2016

will rebase on features branch

@coveralls
Copy link

coveralls commented Jun 25, 2016

Coverage Status

Coverage increased (+0.01%) to 92.429% when pulling 7bc4cc8 on fengxx:feature/override_ini_option into 13a188f on pytest-dev:features.

@coveralls
Copy link

coveralls commented Jun 25, 2016

Coverage Status

Coverage increased (+0.01%) to 92.429% when pulling 7bc4cc8 on fengxx:feature/override_ini_option into 13a188f on pytest-dev:features.

Signed-off-by: Ted Xiao <xiao.xj@gmail.com>
@fengxx fengxx force-pushed the feature/override_ini_option branch from 7bc4cc8 to 856e6ca Compare June 25, 2016 15:45
@coveralls
Copy link

coveralls commented Jun 25, 2016

Coverage Status

Coverage increased (+0.01%) to 92.429% when pulling 856e6ca on fengxx:feature/override_ini_option into 13a188f on pytest-dev:features.

@hpk42 hpk42 merged commit 68bed00 into pytest-dev:features Jun 25, 2016
@hpk42
Copy link
Contributor

hpk42 commented Jun 25, 2016

thanks!

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.

5 participants