From f2512017ead291c49ad805ce76aa58871f442c4a Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Sun, 25 Sep 2011 23:26:49 +0200 Subject: [PATCH] correctly handle zero length cmdline arguments --- CHANGELOG | 1 + _pytest/config.py | 2 +- testing/test_config.py | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index e3bafb69e..12e13fca5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Changes between 2.1.2 and [next version] ---------------------------------------- +- correctly handle zero length arguments (a la pytest '') - fix issue67 / junitxml now contains correct test durations, thanks ronny - fix issue75 / skipping test failure on jython diff --git a/_pytest/config.py b/_pytest/config.py index da5dd593c..19a9d35f9 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -421,7 +421,7 @@ class Config(object): def getcfg(args, inibasenames): - args = [x for x in args if str(x)[0] != "-"] + args = [x for x in args if not str(x).startswith("-")] if not args: args = [py.path.local()] for arg in args: diff --git a/testing/test_config.py b/testing/test_config.py index 1b4f69d39..0a83c3c48 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -16,6 +16,9 @@ class TestParseIni: config._preparse([sub]) assert config.inicfg['name'] == 'value' + def test_getcfg_empty_path(self, tmpdir): + cfg = getcfg([''], ['setup.cfg']) #happens on py.test "" + def test_append_parse_args(self, tmpdir): tmpdir.join("setup.cfg").write(py.code.Source(""" [pytest]