fixes to against python3.3
This commit is contained in:
parent
57a832812b
commit
5173647b4d
|
@ -1,6 +1,8 @@
|
||||||
Changes between 2.2.4 and 2.3.0.dev
|
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
|
- introduce a generic "markers" object on Nodes and a request.node
|
||||||
attribute pointing to the scope-specific collection node of a request.
|
attribute pointing to the scope-specific collection node of a request.
|
||||||
node.markers allows reading and manipulating of MarkInfo objects
|
node.markers allows reading and manipulating of MarkInfo objects
|
||||||
|
|
|
@ -652,6 +652,7 @@ class Metafunc:
|
||||||
for i, valset in enumerate(argvalues):
|
for i, valset in enumerate(argvalues):
|
||||||
assert len(valset) == len(argnames)
|
assert len(valset) == len(argnames)
|
||||||
newcallspec = callspec.copy(self)
|
newcallspec = callspec.copy(self)
|
||||||
|
#print ("setmulti %r id %r" % (argnames, ids[i]))
|
||||||
newcallspec.setmulti(valtype, argnames, valset, ids[i],
|
newcallspec.setmulti(valtype, argnames, valset, ids[i],
|
||||||
scopenum)
|
scopenum)
|
||||||
newcalls.append(newcallspec)
|
newcalls.append(newcallspec)
|
||||||
|
@ -1113,8 +1114,6 @@ class FuncargRequest:
|
||||||
self._addfinalizer(finalizer, scope=scope)
|
self._addfinalizer(finalizer, scope=scope)
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getfuncargvalue(self, argname):
|
def getfuncargvalue(self, argname):
|
||||||
""" Retrieve a function argument by name for this test
|
""" Retrieve a function argument by name for this test
|
||||||
function invocation. This allows one function argument factory
|
function invocation. This allows one function argument factory
|
||||||
|
@ -1408,11 +1407,13 @@ class FuncargManager:
|
||||||
def getsetuplist(self, node):
|
def getsetuplist(self, node):
|
||||||
nodeid = node.nodeid
|
nodeid = node.nodeid
|
||||||
l = []
|
l = []
|
||||||
allargnames = set()
|
allargnames = []
|
||||||
for setupcall in self.setuplist:
|
for setupcall in self.setuplist:
|
||||||
if nodeid.startswith(setupcall.baseid):
|
if nodeid.startswith(setupcall.baseid):
|
||||||
l.append(setupcall)
|
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)
|
l.sort(key=lambda x: x.scopenum)
|
||||||
return l, allargnames
|
return l, allargnames
|
||||||
|
|
||||||
|
|
|
@ -440,7 +440,7 @@ class TerminalReporter:
|
||||||
def summary_stats(self):
|
def summary_stats(self):
|
||||||
session_duration = py.std.time.time() - self._sessionstarttime
|
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():
|
for key in self.stats.keys():
|
||||||
if key not in keys:
|
if key not in keys:
|
||||||
keys.append(key)
|
keys.append(key)
|
||||||
|
|
|
@ -357,13 +357,13 @@ class TestInvocationVariants:
|
||||||
@pytest.mark.skipif("sys.version_info < (2,5)")
|
@pytest.mark.skipif("sys.version_info < (2,5)")
|
||||||
def test_python_minus_m_invocation_ok(self, testdir):
|
def test_python_minus_m_invocation_ok(self, testdir):
|
||||||
p1 = testdir.makepyfile("def test_hello(): pass")
|
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
|
assert res.ret == 0
|
||||||
|
|
||||||
@pytest.mark.skipif("sys.version_info < (2,5)")
|
@pytest.mark.skipif("sys.version_info < (2,5)")
|
||||||
def test_python_minus_m_invocation_fail(self, testdir):
|
def test_python_minus_m_invocation_fail(self, testdir):
|
||||||
p1 = testdir.makepyfile("def test_fail(): 0/0")
|
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
|
assert res.ret == 1
|
||||||
|
|
||||||
@pytest.mark.skipif("sys.version_info < (2,5)")
|
@pytest.mark.skipif("sys.version_info < (2,5)")
|
||||||
|
|
|
@ -2391,7 +2391,7 @@ class TestFuncargMarker:
|
||||||
def test_3(self):
|
def test_3(self):
|
||||||
pass
|
pass
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest("-v")
|
result = testdir.runpytest("-vs")
|
||||||
result.stdout.fnmatch_lines("""
|
result.stdout.fnmatch_lines("""
|
||||||
test_class_ordering.py:4: TestClass2.test_1[1-a] PASSED
|
test_class_ordering.py:4: TestClass2.test_1[1-a] PASSED
|
||||||
test_class_ordering.py:4: TestClass2.test_1[2-a] PASSED
|
test_class_ordering.py:4: TestClass2.test_1[2-a] PASSED
|
||||||
|
|
Loading…
Reference in New Issue