From c64c567b75fd79917ed591116de6882699436fda Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 12 Nov 2012 10:15:43 +0100 Subject: [PATCH] fix issue224 - invocations with >256 char arguments now work --- CHANGELOG | 1 + _pytest/__init__.py | 2 +- _pytest/config.py | 9 +++++++-- setup.py | 2 +- testing/test_config.py | 4 ++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2bc4ac41a..3b1d3f271 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Changes between 2.3.3 and 2.3.4.dev ----------------------------------- +- fix issue224 - invocations with >256 char arguments now work - fix issue91 - add/discuss package/directory level setups in example - allow to dynamically define markers via item.keywords[...]=assignment integrating with "-m" option diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 2c6317352..a61598a98 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.3.4.dev3' +__version__ = '2.3.4.dev4' diff --git a/_pytest/config.py b/_pytest/config.py index 00848cc9d..f3c4034eb 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -181,7 +181,7 @@ class Conftest(object): if hasattr(arg, 'startswith') and arg.startswith("--"): continue anchor = current.join(arg, abs=1) - if anchor.check(): # we found some file object + if exists(anchor): # we found some file object self._try_load_conftest(anchor) foundanchor = True if not foundanchor: @@ -479,6 +479,11 @@ class Config(object): except KeyError: py.test.skip("no %r value found" %(name,)) +def exists(path, ignore=EnvironmentError): + try: + return path.check() + except ignore: + return False def getcfg(args, inibasenames): args = [x for x in args if not str(x).startswith("-")] @@ -489,7 +494,7 @@ def getcfg(args, inibasenames): for base in arg.parts(reverse=True): for inibasename in inibasenames: p = base.join(inibasename) - if p.check(): + if exists(p): iniconfig = py.iniconfig.IniConfig(p) if 'pytest' in iniconfig.sections: return iniconfig['pytest'] diff --git a/setup.py b/setup.py index 041c4bda7..2970ed328 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ def main(): name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.3.4.dev3', + version='2.3.4.dev4', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/test_config.py b/testing/test_config.py index 05ac490bf..c1de49ed8 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -315,3 +315,7 @@ def test_cmdline_processargs_simple(testdir): "*-h*", ]) + +def test_toolongargs_issue224(testdir): + result = testdir.runpytest("-m", "hello" * 500) + assert result.ret == 0