diff --git a/pytest/__init__.py b/pytest/__init__.py index 6d3de93be..78c4db933 100644 --- a/pytest/__init__.py +++ b/pytest/__init__.py @@ -5,7 +5,7 @@ see http://pytest.org for documentation and details (c) Holger Krekel and others, 2004-2010 """ -__version__ = '2.0.0.dev14' +__version__ = '2.0.0.dev15' __all__ = ['config', 'cmdline'] diff --git a/pytest/plugin/config.py b/pytest/plugin/config.py index 194536a8e..5cc9cf612 100644 --- a/pytest/plugin/config.py +++ b/pytest/plugin/config.py @@ -297,7 +297,7 @@ class Config(object): if self.inicfg: newargs = self.inicfg.get("addargs", None) if newargs: - args[:] = args + py.std.shlex.split(newargs) + args[:] = py.std.shlex.split(newargs) + args self._checkversion() self.pluginmanager.consider_setuptools_entrypoints() self.pluginmanager.consider_env() @@ -414,6 +414,7 @@ class Config(object): def getcfg(args, inibasenames): + args = [x for x in args if str(x)[0] != "-"] if not args: args = [py.path.local()] for inibasename in inibasenames: diff --git a/setup.py b/setup.py index 9deaaf49a..d17ed62ba 100644 --- 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.dev14', + version='2.0.0.dev15', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 45d959fb2..572290d05 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -13,6 +13,11 @@ class TestGeneralUsage: '*ERROR: hello' ]) + def test_file_not_found(self, testdir): + result = testdir.runpytest("asd") + assert result.ret != 0 + result.stderr.fnmatch_lines(["ERROR: file not found*asd"]) + def test_config_preparse_plugin_option(self, testdir): testdir.makepyfile(pytest_xyz=""" def pytest_addoption(parser): diff --git a/testing/plugin/test_python.py b/testing/plugin/test_python.py index 2efbd5b07..4de757549 100644 --- a/testing/plugin/test_python.py +++ b/testing/plugin/test_python.py @@ -2,16 +2,6 @@ import py, sys from pytest.plugin import python as funcargs class TestModule: - def test_module_file_not_found(self, testdir): - tmpdir = testdir.tmpdir - fn = tmpdir.join('nada','no') - config=testdir.Config() - config.args = ["hello"] - col = py.test.collect.Module(fn, config=config, - collection=testdir.Collection(config)) - col.config = testdir.parseconfig(tmpdir) - py.test.raises(py.error.ENOENT, col.collect) - def test_failing_import(self, testdir): modcol = testdir.getmodulecol("import alksdjalskdjalkjals") py.test.raises(ImportError, modcol.collect) diff --git a/testing/test_config.py b/testing/test_config.py index 5c4226ef8..d9a3b8692 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -66,6 +66,9 @@ class TestConfigTmpdir: assert not config2.getbasetemp().relto(config3.getbasetemp()) assert not config3.getbasetemp().relto(config2.getbasetemp()) + def test_reparse_filename_too_long(self, testdir): + config = testdir.reparseconfig(["--basetemp=%s" % ("123"*300)]) + class TestConfigAPI: def test_config_getvalue_honours_conftest(self, testdir): diff --git a/tox.ini b/tox.ini index b50e93735..04e18188b 100644 --- a/tox.ini +++ b/tox.ini @@ -52,4 +52,4 @@ commands= [pytest] minversion=2.0 plugins=pytester -#addargs=-q -x +#addargs=-rf