fixes to against python3.3

This commit is contained in:
holger krekel 2012-10-01 10:14:54 +02:00
parent 57a832812b
commit 5173647b4d
5 changed files with 12 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)")

View File

@ -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