flatten test directory hierarchy and merge smaller into larger files
--HG-- branch : trunk
This commit is contained in:
parent
40f41496d8
commit
5c27076d32
|
@ -1 +0,0 @@
|
||||||
#
|
|
|
@ -1,42 +0,0 @@
|
||||||
import py,sys
|
|
||||||
|
|
||||||
class TestRecordingAccept:
|
|
||||||
def test_recording_and_back(self, testdir):
|
|
||||||
py.test.skip("implementation missing: recording")
|
|
||||||
p = testdir.makepyfile("""
|
|
||||||
import py
|
|
||||||
def test_fail():
|
|
||||||
assert x
|
|
||||||
def test_skip():
|
|
||||||
py.test.skip("hello")
|
|
||||||
def test_pass():
|
|
||||||
pass
|
|
||||||
""")
|
|
||||||
rdir = py.path.local("rdir")
|
|
||||||
result = self.runpytest(p, "--record=%s" %(rdir))
|
|
||||||
record = py.test.RecordDir(result)
|
|
||||||
testrun = record.getlastrun()
|
|
||||||
assert testrun.sys.platform == sys.platform
|
|
||||||
assert testrun.sys.version_info == sys.version_info
|
|
||||||
assert testrun.sys.executable == sys.executable
|
|
||||||
|
|
||||||
baseadress = ("test_one.py",)
|
|
||||||
failures = testrun.getfailures()
|
|
||||||
assert len(failures) == 1
|
|
||||||
failure = failures[0]
|
|
||||||
assert failure.testaddress == baseadress + ("test_fail",)
|
|
||||||
assert failure.location.find("test_one.py:3") != -1
|
|
||||||
assert failure.errmessage
|
|
||||||
assert failure.reprfailure # probably just a string for now
|
|
||||||
|
|
||||||
skipped = testrun.getskipped()
|
|
||||||
assert len(skipped) == 1
|
|
||||||
skip = skipped[0]
|
|
||||||
assert skip.testaddress == baseaddress + ("test_skip",)
|
|
||||||
assert skip.location == "test_one.py:7"
|
|
||||||
|
|
||||||
passed = testrun.getpassed()
|
|
||||||
assert len(passed) == 1
|
|
||||||
p = passed[0]
|
|
||||||
assert p.testaddress == baseaddress + ("test_skip",)
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
import py
|
|
||||||
|
|
||||||
class TestTracebackCutting:
|
|
||||||
def test_skip_simple(self):
|
|
||||||
from py.impl.test.outcome import Skipped
|
|
||||||
excinfo = py.test.raises(Skipped, 'py.test.skip("xxx")')
|
|
||||||
assert excinfo.traceback[-1].frame.code.name == "skip"
|
|
||||||
assert excinfo.traceback[-1].ishidden()
|
|
||||||
|
|
||||||
def test_traceback_argsetup(self, testdir):
|
|
||||||
testdir.makeconftest("""
|
|
||||||
def pytest_funcarg__hello(request):
|
|
||||||
raise ValueError("xyz")
|
|
||||||
""")
|
|
||||||
p = testdir.makepyfile("def test(hello): pass")
|
|
||||||
result = testdir.runpytest(p)
|
|
||||||
assert result.ret != 0
|
|
||||||
out = result.stdout.str()
|
|
||||||
assert out.find("xyz") != -1
|
|
||||||
assert out.find("conftest.py:2: ValueError") != -1
|
|
||||||
numentries = out.count("_ _ _") # separator for traceback entries
|
|
||||||
assert numentries == 0
|
|
||||||
|
|
||||||
result = testdir.runpytest("--fulltrace", p)
|
|
||||||
out = result.stdout.str()
|
|
||||||
assert out.find("conftest.py:2: ValueError") != -1
|
|
||||||
numentries = out.count("_ _ _ _") # separator for traceback entries
|
|
||||||
assert numentries >3
|
|
|
@ -440,3 +440,31 @@ def test_modulecol_roundtrip(testdir):
|
||||||
trail = modcol.config._rootcol.totrail(modcol)
|
trail = modcol.config._rootcol.totrail(modcol)
|
||||||
newcol = modcol.config._rootcol.fromtrail(trail)
|
newcol = modcol.config._rootcol.fromtrail(trail)
|
||||||
assert modcol.name == newcol.name
|
assert modcol.name == newcol.name
|
||||||
|
|
||||||
|
|
||||||
|
class TestTracebackCutting:
|
||||||
|
def test_skip_simple(self):
|
||||||
|
from py.impl.test.outcome import Skipped
|
||||||
|
excinfo = py.test.raises(Skipped, 'py.test.skip("xxx")')
|
||||||
|
assert excinfo.traceback[-1].frame.code.name == "skip"
|
||||||
|
assert excinfo.traceback[-1].ishidden()
|
||||||
|
|
||||||
|
def test_traceback_argsetup(self, testdir):
|
||||||
|
testdir.makeconftest("""
|
||||||
|
def pytest_funcarg__hello(request):
|
||||||
|
raise ValueError("xyz")
|
||||||
|
""")
|
||||||
|
p = testdir.makepyfile("def test(hello): pass")
|
||||||
|
result = testdir.runpytest(p)
|
||||||
|
assert result.ret != 0
|
||||||
|
out = result.stdout.str()
|
||||||
|
assert out.find("xyz") != -1
|
||||||
|
assert out.find("conftest.py:2: ValueError") != -1
|
||||||
|
numentries = out.count("_ _ _") # separator for traceback entries
|
||||||
|
assert numentries == 0
|
||||||
|
|
||||||
|
result = testdir.runpytest("--fulltrace", p)
|
||||||
|
out = result.stdout.str()
|
||||||
|
assert out.find("conftest.py:2: ValueError") != -1
|
||||||
|
numentries = out.count("_ _ _ _") # separator for traceback entries
|
||||||
|
assert numentries >3
|
Loading…
Reference in New Issue