From 5173647b4d96a6505269557614f8944901b305e5 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 1 Oct 2012 10:14:54 +0200 Subject: [PATCH] fixes to against python3.3 --- CHANGELOG | 2 ++ _pytest/python.py | 9 +++++---- _pytest/terminal.py | 2 +- testing/acceptance_test.py | 6 +++--- testing/test_python.py | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7de71184e..967b2132d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ Changes between 2.2.4 and 2.3.0.dev ----------------------------------- +- fix python3.3 compat, mostly reporting bits that previously depended + on dict ordering - introduce a generic "markers" object on Nodes and a request.node attribute pointing to the scope-specific collection node of a request. node.markers allows reading and manipulating of MarkInfo objects diff --git a/_pytest/python.py b/_pytest/python.py index c5f1a334f..e5d6ffbf0 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -652,6 +652,7 @@ class Metafunc: for i, valset in enumerate(argvalues): assert len(valset) == len(argnames) newcallspec = callspec.copy(self) + #print ("setmulti %r id %r" % (argnames, ids[i])) newcallspec.setmulti(valtype, argnames, valset, ids[i], scopenum) newcalls.append(newcallspec) @@ -1113,8 +1114,6 @@ class FuncargRequest: self._addfinalizer(finalizer, scope=scope) return val - - def getfuncargvalue(self, argname): """ Retrieve a function argument by name for this test function invocation. This allows one function argument factory @@ -1408,11 +1407,13 @@ class FuncargManager: def getsetuplist(self, node): nodeid = node.nodeid l = [] - allargnames = set() + allargnames = [] for setupcall in self.setuplist: if nodeid.startswith(setupcall.baseid): l.append(setupcall) - allargnames.update(setupcall.funcargnames) + for arg in setupcall.funcargnames: + if arg not in allargnames: + allargnames.append(arg) l.sort(key=lambda x: x.scopenum) return l, allargnames diff --git a/_pytest/terminal.py b/_pytest/terminal.py index fe4f80b3f..501956b5b 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -440,7 +440,7 @@ class TerminalReporter: def summary_stats(self): session_duration = py.std.time.time() - self._sessionstarttime - keys = "failed passed skipped deselected".split() + keys = "failed passed skipped deselected xfailed xpassed".split() for key in self.stats.keys(): if key not in keys: keys.append(key) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 8b4bc86c1..623f29b27 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -71,7 +71,7 @@ class TestGeneralUsage: "*---configure", "*---unconfigure", ]) - + def test_config_preparse_plugin_option(self, testdir): testdir.makepyfile(pytest_xyz=""" @@ -357,13 +357,13 @@ class TestInvocationVariants: @pytest.mark.skipif("sys.version_info < (2,5)") def test_python_minus_m_invocation_ok(self, testdir): p1 = testdir.makepyfile("def test_hello(): pass") - res = testdir.run(py.std.sys.executable, "-m", "py.test", str(p1)) + res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1)) assert res.ret == 0 @pytest.mark.skipif("sys.version_info < (2,5)") def test_python_minus_m_invocation_fail(self, testdir): p1 = testdir.makepyfile("def test_fail(): 0/0") - res = testdir.run(py.std.sys.executable, "-m", "py.test", str(p1)) + res = testdir.run(py.std.sys.executable, "-m", "pytest", str(p1)) assert res.ret == 1 @pytest.mark.skipif("sys.version_info < (2,5)") diff --git a/testing/test_python.py b/testing/test_python.py index 891efe221..d710b5d61 100644 --- a/testing/test_python.py +++ b/testing/test_python.py @@ -2391,7 +2391,7 @@ class TestFuncargMarker: def test_3(self): pass """) - result = testdir.runpytest("-v") + result = testdir.runpytest("-vs") result.stdout.fnmatch_lines(""" test_class_ordering.py:4: TestClass2.test_1[1-a] PASSED test_class_ordering.py:4: TestClass2.test_1[2-a] PASSED