Skip to content

Commit

Permalink
Merge pull request pytest-dev#6005 from blueyed/harden-trial
Browse files Browse the repository at this point in the history
tests: harden/fix test_trial_error
  • Loading branch information
blueyed committed Oct 20, 2019
2 parents b5579d2 + 5b88612 commit fbb7f66
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions testing/test_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def tearDownClass(self):
def test_method_and_teardown_failing_reporting(testdir):
testdir.makepyfile(
"""
import unittest, pytest
import unittest
class TC(unittest.TestCase):
def tearDown(self):
assert 0, "down1"
Expand Down Expand Up @@ -530,19 +530,31 @@ def f(_):
# will crash both at test time and at teardown
"""
)
result = testdir.runpytest()
# Ignore DeprecationWarning (for `cmp`) from attrs through twisted,
# for stable test results.
result = testdir.runpytest(
"-vv", "-oconsole_output_style=classic", "-W", "ignore::DeprecationWarning"
)
result.stdout.fnmatch_lines(
[
"test_trial_error.py::TC::test_four FAILED",
"test_trial_error.py::TC::test_four ERROR",
"test_trial_error.py::TC::test_one FAILED",
"test_trial_error.py::TC::test_three FAILED",
"test_trial_error.py::TC::test_two FAILED",
"*ERRORS*",
"*_ ERROR at teardown of TC.test_four _*",
"*DelayedCalls*",
"*test_four*",
"*= FAILURES =*",
"*_ TC.test_four _*",
"*NameError*crash*",
"*test_one*",
"*_ TC.test_one _*",
"*NameError*crash*",
"*test_three*",
"*_ TC.test_three _*",
"*DelayedCalls*",
"*test_two*",
"*crash*",
"*_ TC.test_two _*",
"*NameError*crash*",
"*= 4 failed, 1 error in *",
]
)

Expand Down

0 comments on commit fbb7f66

Please sign in to comment.