[py-svn] py-trunk commit 7c865991c921: update ISSUES some more, introduce duration to RunResult and a failing dist-testing termination test.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Dec 30 13:05:36 CET 2009


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview/
# User holger krekel <holger at merlinux.eu>
# Date 1262169466 -3600
# Node ID 7c865991c921761dc18d4de4becc4f031cd088ca
# Parent cf5995e234619de5dccd1ff6757b9e63be65e3a9
update ISSUES some more, introduce duration to RunResult and a failing dist-testing termination test.

--- a/ISSUES.txt
+++ b/ISSUES.txt
@@ -1,16 +1,16 @@
 
 introduce py.test.mark.nocollect
 -------------------------------------------------------
-tags: feature
+tags: feature 1.2
 
 for not considering a function for test collection at all. 
 maybe also introduce a py.test.mark.test to explicitely
-mark a function to become a tested one.  Lookup 
-
+mark a function to become a tested one.  Lookup JUnit 
+ways of tagging tests. 
 
 have imported module mismatch honour relative paths
 --------------------------------------------------------
-tags: bug
+tags: bug 1.2
 
 With 1.1.1 py.test fails at least on windows if an import 
 is relative and compared against an absolute conftest.py 
@@ -18,7 +18,7 @@ path. Normalize.
 
 allow plugins/conftests to show extra header information
 --------------------------------------------------------
-tags: feature
+tags: feature 1.2
 
 The test-report header should optionally show information
 about the under-test package and versions/locations of
@@ -26,7 +26,7 @@ involved packages.
 
 make node._checkcollectable more robust
 -------------------------------------------------
-tags: bug 1.1.2
+tags: bug 1.2
 
 currently node._checkcollectable() can raise
 exceptions for all kinds of reasons ('conftest.py' loading
@@ -36,35 +36,41 @@ a good error message.
 
 call termination with small timeout
 -------------------------------------------------
-tags: feature 1.1.2
+tags: feature 1.2
+test: testing/pytest/dist/test_dsession.py - test_terminate_on_hanging_node
 
 Call gateway group termination with a small timeout if available. 
 Should make dist-testing less likely to leave lost processes.
 
-make capfd skip if 'dup' is not available
--------------------------------------------------------
-
-tags: feature 1.1.2
-
-currently, using 'capfd' as a funcarg will fail because
-it cannot call os.dup on setup.  Should cause a skip.
-
-introduce multi-install, i.e. py.test3, py.test-pypy, py.test-jython
-and maybe a commandline-"suffix" override? 
-
 fix dist-testing: execnet needs to be rsynced over automatically
 ------------------------------------------------------------------
 
-tags: bug 1.1.2
+tags: bug 1.2
 bb: http://bitbucket.org/hpk42/py-trunk/issue/65/
 
 execnet is not rsynced so fails if run in an ssh-situation. 
 write test and fix.
 
+dist-testing: fix session hook / setup calling
+-----------------------------------------------------
+tags: bug 1.2
+
+Currently pytest_sessionstart and finish are called 
+on the master node and not on the slaves.  Call
+it on slaves and provide a session.nodeid which defaults
+to None for the master and contains the gateway id 
+for slaves. 
+
+have --report=xfailed[-detail] report the actual tracebacks 
+------------------------------------------------------------------
+tags: feature
+
+there is no way to induce py.test to display the full tracebacks
+of the expected failure.  Introduce one.
 
 relax requirement to have tests/testing contain an __init__
 ----------------------------------------------------------------
-tags: feature 1.1.2
+tags: feature 1.2
 bb: http://bitbucket.org/hpk42/py-trunk/issue/64
 
 A local test run of a "tests" directory may work 
@@ -74,7 +80,7 @@ an error or make it work without the __i
 
 deprecate ensuretemp / introduce funcargs to setup method
 --------------------------------------------------------------
-tags: wish 1.1.2
+tags: experimental-wish 1.2
 
 The remaining uses of py.test.ensuretemp within the py-test base
 itself are for setup methods.  Also users have expressed the

--- a/testing/pytest/dist/test_dsession.py
+++ b/testing/pytest/dist/test_dsession.py
@@ -440,4 +440,19 @@ def test_teardownfails_one_function(test
         "*1 passed*1 error*"
     ])
 
+ at py.test.mark.xfail 
+def test_terminate_on_hangingnode(testdir):
+    p = testdir.makeconftest("""
+        def pytest__teardown_final(session):
+            if session.nodeid: # running on slave
+                import time
+                time.sleep(2)
+    """)
+    result = testdir.runpytest(p, '--dist=each', '--tx=popen')
+    assert result.duration < 2.0 
+    result.stdout.fnmatch_lines([
+        "*0 passed*",
+    ])
 
+
+

--- a/py/plugin/pytest_pytester.py
+++ b/py/plugin/pytest_pytester.py
@@ -6,6 +6,7 @@ import py
 import sys, os
 import re
 import inspect
+import time
 from py.impl.test.config import Config as pytestConfig
 from py.plugin import hookspec
 from py.builtin import print_
@@ -24,12 +25,14 @@ def pytest_funcarg__testdir(request):
 
 rex_outcome = re.compile("(\d+) (\w+)")
 class RunResult:
-    def __init__(self, ret, outlines, errlines):
+    def __init__(self, ret, outlines, errlines, duration):
         self.ret = ret
         self.outlines = outlines
         self.errlines = errlines
         self.stdout = LineMatcher(outlines)
         self.stderr = LineMatcher(errlines)
+        self.duration = duration
+
     def parseoutcomes(self):
         for line in reversed(self.outlines):
             if 'seconds' in line:
@@ -284,6 +287,7 @@ class TmpTestdir:
         print_("running", cmdargs, "curdir=", py.path.local())
         f1 = p1.open("w")
         f2 = p2.open("w")
+        now = time.time()
         popen = self.popen(cmdargs, stdout=f1, stderr=f2, 
             close_fds=(sys.platform != "win32"))
         ret = popen.wait()
@@ -296,7 +300,7 @@ class TmpTestdir:
         if out:
             for line in out: 
                 py.builtin.print_(line, file=sys.stdout)
-        return RunResult(ret, out, err)
+        return RunResult(ret, out, err, time.time()-now)
 
     def runpybin(self, scriptname, *args):
         fullargs = self._getpybinargs(scriptname) + args



More information about the pytest-commit mailing list