[py-svn] pytest commit 37e6a9570c34: rename addargs to addopts, make adding of opts configurable
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Nov 1 08:54:45 CET 2010
# HG changeset patch -- Bitbucket.org
# Project pytest
# URL http://bitbucket.org/hpk42/pytest/overview
# User holger krekel <holger at merlinux.eu>
# Date 1288598114 -3600
# Node ID 37e6a9570c348624983020109d83287e0b37ddf7
# Parent ff5f9cf9ff576554f02c8ecd1e4717a22dbe0728
rename addargs to addopts, make adding of opts configurable
--- a/pytest/plugin/config.py
+++ b/pytest/plugin/config.py
@@ -11,7 +11,7 @@ def pytest_cmdline_parse(pluginmanager,
return config
def pytest_addoption(parser):
- parser.addini('addargs', 'default command line arguments')
+ parser.addini('addopts', 'default command line arguments')
parser.addini('minversion', 'minimally required pytest version')
class Parser:
@@ -292,10 +292,11 @@ class Config(object):
sys.stderr.write(err)
raise
- def _preparse(self, args):
+ def _preparse(self, args, addopts=True):
+ self.inicfg = {}
self.inicfg = getcfg(args, ["setup.cfg", "tox.ini",])
- if self.inicfg:
- newargs = self.inicfg.get("addargs", None)
+ if self.inicfg and addopts:
+ newargs = self.inicfg.get("addopts", None)
if newargs:
args[:] = py.std.shlex.split(newargs) + args
self._checkversion()
--- a/pytest/__init__.py
+++ b/pytest/__init__.py
@@ -5,7 +5,7 @@ see http://pytest.org for documentation
(c) Holger Krekel and others, 2004-2010
"""
-__version__ = '2.0.0.dev15'
+__version__ = '2.0.0.dev16'
__all__ = ['config', 'cmdline']
--- a/doc/customize.txt
+++ b/doc/customize.txt
@@ -45,13 +45,13 @@ builtin configuration file options
minversion = 2.1 # will fail if we run with pytest-2.0
-.. confval:: addargs = OPTS
+.. confval:: addopts = OPTS
add the specified ``OPTS`` to the set of command line arguments as if they
had been specified by the user. Example: if you have this ini file content::
[pytest]
- addargs = --maxfail=2 -rf # exit after 2 failures, report fail info
+ addopts = --maxfail=2 -rf # exit after 2 failures, report fail info
issuing ``py.test test_hello.py`` actually means::
--- a/testing/test_config.py
+++ b/testing/test_config.py
@@ -19,11 +19,15 @@ class TestParseIni:
def test_append_parse_args(self, tmpdir):
tmpdir.join("setup.cfg").write(py.code.Source("""
[pytest]
- addargs = --verbose
+ addopts = --verbose
"""))
config = Config()
config.parse([tmpdir])
assert config.option.verbose
+ config = Config()
+ args = [tmpdir,]
+ config._preparse(args, addopts=False)
+ assert len(args) == 1
def test_tox_ini_wrong_version(self, testdir):
p = testdir.makefile('.ini', tox="""
--- a/testing/plugin/test_terminal.py
+++ b/testing/plugin/test_terminal.py
@@ -475,8 +475,8 @@ def test_getreportopt():
config.option.reportchars = "sfx"
assert getreportopt(config) == "sfx"
-def test_terminalreporter_reportopt_addargs(testdir):
- testdir.makeini("[pytest]\naddargs=-rs")
+def test_terminalreporter_reportopt_addopts(testdir):
+ testdir.makeini("[pytest]\naddopts=-rs")
p = testdir.makepyfile("""
def pytest_funcarg__tr(request):
tr = request.config.pluginmanager.getplugin("terminalreporter")
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ def main():
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
- version='2.0.0.dev15',
+ version='2.0.0.dev16',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
More information about the pytest-commit
mailing list