Skip to content

Commit fbb7f66

Browse files
authored
Merge pull request #6005 from blueyed/harden-trial
tests: harden/fix test_trial_error
2 parents b5579d2 + 5b88612 commit fbb7f66

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

testing/test_unittest.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def tearDownClass(self):
233233
def test_method_and_teardown_failing_reporting(testdir):
234234
testdir.makepyfile(
235235
"""
236-
import unittest, pytest
236+
import unittest
237237
class TC(unittest.TestCase):
238238
def tearDown(self):
239239
assert 0, "down1"
@@ -530,19 +530,31 @@ def f(_):
530530
# will crash both at test time and at teardown
531531
"""
532532
)
533-
result = testdir.runpytest()
533+
# Ignore DeprecationWarning (for `cmp`) from attrs through twisted,
534+
# for stable test results.
535+
result = testdir.runpytest(
536+
"-vv", "-oconsole_output_style=classic", "-W", "ignore::DeprecationWarning"
537+
)
534538
result.stdout.fnmatch_lines(
535539
[
540+
"test_trial_error.py::TC::test_four FAILED",
541+
"test_trial_error.py::TC::test_four ERROR",
542+
"test_trial_error.py::TC::test_one FAILED",
543+
"test_trial_error.py::TC::test_three FAILED",
544+
"test_trial_error.py::TC::test_two FAILED",
536545
"*ERRORS*",
546+
"*_ ERROR at teardown of TC.test_four _*",
537547
"*DelayedCalls*",
538-
"*test_four*",
548+
"*= FAILURES =*",
549+
"*_ TC.test_four _*",
539550
"*NameError*crash*",
540-
"*test_one*",
551+
"*_ TC.test_one _*",
541552
"*NameError*crash*",
542-
"*test_three*",
553+
"*_ TC.test_three _*",
543554
"*DelayedCalls*",
544-
"*test_two*",
545-
"*crash*",
555+
"*_ TC.test_two _*",
556+
"*NameError*crash*",
557+
"*= 4 failed, 1 error in *",
546558
]
547559
)
548560

0 commit comments

Comments
 (0)