Skip to content

Commit e8549d5

Browse files
committed
Don't check the number of warnings, only their text
1 parent fcd580a commit e8549d5

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

test_pytest_rerunfailures.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def temporary_failure(count=1):
2121

2222

2323
def assert_outcomes(result, passed=1, skipped=0, failed=0, error=0, xfailed=0,
24-
xpassed=0, rerun=0, warnings=0):
24+
xpassed=0, rerun=0):
2525
outcomes = result.parseoutcomes()
2626
assert outcomes.get('passed', 0) == passed
2727
assert outcomes.get('skipped', 0) == skipped
@@ -30,12 +30,6 @@ def assert_outcomes(result, passed=1, skipped=0, failed=0, error=0, xfailed=0,
3030
assert outcomes.get('xpassed', 0) == xpassed
3131
assert outcomes.get('rerun', 0) == rerun
3232

33-
warnings_key = 'warnings'
34-
if warnings <= 1 and pytest_version_gte_53:
35-
# due to https://github.com/pytest-dev/pytest/pull/5990
36-
warnings_key = 'warning'
37-
assert outcomes.get(warnings_key, 0) == warnings
38-
3933

4034
def test_error_when_run_with_pdb(testdir):
4135
testdir.makepyfile('def test_pass(): pass')
@@ -252,7 +246,7 @@ def test_fail():
252246

253247
time.sleep.assert_called_with(delay_time)
254248

255-
assert_outcomes(result, passed=0, failed=1, rerun=3, warnings=num_warnings)
249+
assert_outcomes(result, passed=0, failed=1, rerun=3)
256250

257251
if num_warnings:
258252
result.stdout.fnmatch_lines('*UserWarning: Delay time between re-runs cannot be < 0. Using default value: 0')
@@ -277,7 +271,7 @@ def test_fail_two():
277271

278272
time.sleep.assert_called_with(delay_time)
279273

280-
assert_outcomes(result, passed=0, failed=1, rerun=2, warnings=num_warnings)
274+
assert_outcomes(result, passed=0, failed=1, rerun=2)
281275

282276
if num_warnings:
283277
result.stdout.fnmatch_lines('*UserWarning: Delay time between re-runs cannot be < 0. Using default value: 0')

0 commit comments

Comments
 (0)