Merge pull request #125 from reginaldl/master
Mark test as complete at teardown.
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
and ``EachScheduling`` implementations. Note that required scheduler class public
|
||||
API may change in next ``pytest-xdist`` versions.
|
||||
|
||||
- fix #124: xdist would mark test as complete after 'call' step. As a result,
|
||||
xdist could identify the wrong test as failing when test crashes at teardown.
|
||||
To address this issue, xdist now marks test as complete at teardown.
|
||||
|
||||
1.15.0
|
||||
------
|
||||
|
||||
|
||||
@@ -437,7 +437,32 @@ def test_crashing_item(testdir):
|
||||
""")
|
||||
result = testdir.runpytest("-n2", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*crashed*test_crash*", "*1 failed*1 passed*"
|
||||
"*crashed*::test_crash*", "*1 failed*1 passed*"
|
||||
])
|
||||
|
||||
|
||||
def test_crashing_item_teardown(testdir):
|
||||
p = testdir.makepyfile("""
|
||||
import py
|
||||
import pytest
|
||||
import os
|
||||
import time
|
||||
|
||||
@pytest.fixture
|
||||
def crash_fixture(request):
|
||||
def kill_me():
|
||||
py.process.kill(os.getpid())
|
||||
request.addfinalizer(kill_me)
|
||||
|
||||
def test_a(crash_fixture):
|
||||
pass
|
||||
|
||||
def test_b():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest("-n1", p)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*crashed*::test_a*", "*1 failed*2 passed*"
|
||||
])
|
||||
|
||||
|
||||
|
||||
@@ -660,7 +660,7 @@ class DSession:
|
||||
If the node indicates it is finished with a test item, remove
|
||||
the item from the pending list in the scheduler.
|
||||
"""
|
||||
if rep.when == "call" or (rep.when == "setup" and not rep.passed):
|
||||
if rep.when == "teardown" or (rep.when == "setup" and not rep.passed):
|
||||
self.sched.mark_test_complete(node, rep.item_index, rep.duration)
|
||||
# self.report_line("testreport %s: %s" %(rep.id, rep.status))
|
||||
rep.node = node
|
||||
|
||||
Reference in New Issue
Block a user