From 5b21c540b68915963be4dfc08be92f51016857d9 Mon Sep 17 00:00:00 2001 From: hpk Date: Tue, 23 Sep 2008 16:25:16 +0200 Subject: [PATCH] [svn r58384] adding a test for unimplemented recording feature --HG-- branch : trunk --- py/test/testing/test_recording.py | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 py/test/testing/test_recording.py diff --git a/py/test/testing/test_recording.py b/py/test/testing/test_recording.py new file mode 100644 index 000000000..784a15ce1 --- /dev/null +++ b/py/test/testing/test_recording.py @@ -0,0 +1,45 @@ +import py,sys +py.test.skip("implementation missing: recording") + +from py.__.test.testing import suptest +from py.__.test.acceptance_test import AcceptBase + +class TestRecordingAccept(AcceptBase): + def test_recording_and_back(self): + p = self.makepyfile(test_one=""" + 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",) +