diff --git a/testing/pytest/acceptance_test.py b/testing/acceptance_test.py similarity index 100% rename from testing/pytest/acceptance_test.py rename to testing/acceptance_test.py diff --git a/testing/pytest/conftest.py b/testing/conftest.py similarity index 100% rename from testing/pytest/conftest.py rename to testing/conftest.py diff --git a/testing/pytest/__init__.py b/testing/pytest/__init__.py deleted file mode 100644 index 792d60054..000000000 --- a/testing/pytest/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# diff --git a/testing/pytest/test_recording.py b/testing/pytest/test_recording.py deleted file mode 100644 index 8c143d933..000000000 --- a/testing/pytest/test_recording.py +++ /dev/null @@ -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",) - diff --git a/testing/pytest/test_traceback.py b/testing/pytest/test_traceback.py deleted file mode 100644 index c14c31999..000000000 --- a/testing/pytest/test_traceback.py +++ /dev/null @@ -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 diff --git a/testing/test_builtin.py b/testing/root/test_builtin.py similarity index 100% rename from testing/test_builtin.py rename to testing/root/test_builtin.py diff --git a/testing/test_py_imports.py b/testing/root/test_py_imports.py similarity index 100% rename from testing/test_py_imports.py rename to testing/root/test_py_imports.py diff --git a/testing/pytest/test_collect.py b/testing/test_collect.py similarity index 100% rename from testing/pytest/test_collect.py rename to testing/test_collect.py diff --git a/testing/pytest/test_compat.py b/testing/test_compat.py similarity index 100% rename from testing/pytest/test_compat.py rename to testing/test_compat.py diff --git a/testing/pytest/test_config.py b/testing/test_config.py similarity index 100% rename from testing/pytest/test_config.py rename to testing/test_config.py diff --git a/testing/pytest/test_conftesthandle.py b/testing/test_conftesthandle.py similarity index 100% rename from testing/pytest/test_conftesthandle.py rename to testing/test_conftesthandle.py diff --git a/testing/pytest/test_deprecated_api.py b/testing/test_deprecated_api.py similarity index 100% rename from testing/pytest/test_deprecated_api.py rename to testing/test_deprecated_api.py diff --git a/testing/pytest/test_funcargs.py b/testing/test_funcargs.py similarity index 100% rename from testing/pytest/test_funcargs.py rename to testing/test_funcargs.py diff --git a/testing/pytest/test_genitems.py b/testing/test_genitems.py similarity index 100% rename from testing/pytest/test_genitems.py rename to testing/test_genitems.py diff --git a/testing/pytest/test_outcome.py b/testing/test_outcome.py similarity index 100% rename from testing/pytest/test_outcome.py rename to testing/test_outcome.py diff --git a/testing/pytest/test_parseopt.py b/testing/test_parseopt.py similarity index 100% rename from testing/pytest/test_parseopt.py rename to testing/test_parseopt.py diff --git a/testing/pytest/test_pluginmanager.py b/testing/test_pluginmanager.py similarity index 100% rename from testing/pytest/test_pluginmanager.py rename to testing/test_pluginmanager.py diff --git a/testing/pytest/test_pycollect.py b/testing/test_pycollect.py similarity index 93% rename from testing/pytest/test_pycollect.py rename to testing/test_pycollect.py index 8714bda40..e95ae7e46 100644 --- a/testing/pytest/test_pycollect.py +++ b/testing/test_pycollect.py @@ -440,3 +440,31 @@ def test_modulecol_roundtrip(testdir): trail = modcol.config._rootcol.totrail(modcol) newcol = modcol.config._rootcol.fromtrail(trail) 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 diff --git a/testing/pytest/test_session.py b/testing/test_session.py similarity index 100% rename from testing/pytest/test_session.py rename to testing/test_session.py