Use result.stderr in tests since result.errlines has changed behaviour.

This commit is contained in:
Niclas Olofsson 2015-09-26 14:59:28 +02:00 committed by David Szotten
parent 1d23bef3fb
commit 33f1ff4e8c
1 changed files with 6 additions and 7 deletions

View File

@ -60,7 +60,6 @@ def broken_testdir(testdir):
def test_run_without_stepwise(stepwise_testdir):
result = stepwise_testdir.runpytest('-v', '--strict', '--fail')
assert not result.errlines
result.stdout.fnmatch_lines(['*test_success_before_fail PASSED*'])
result.stdout.fnmatch_lines(['*test_fail_on_flag FAILED*'])
result.stdout.fnmatch_lines(['*test_success_after_fail PASSED*'])
@ -69,7 +68,7 @@ def test_run_without_stepwise(stepwise_testdir):
def test_fail_and_continue_with_stepwise(stepwise_testdir):
# Run the tests with a failing second test.
result = stepwise_testdir.runpytest('-v', '--strict', '--stepwise', '--fail')
assert not result.errlines
assert not result.stderr.str()
stdout = result.stdout.str()
# Make sure we stop after first failing test.
@ -79,7 +78,7 @@ def test_fail_and_continue_with_stepwise(stepwise_testdir):
# "Fix" the test that failed in the last run and run it again.
result = stepwise_testdir.runpytest('-v', '--strict', '--stepwise')
assert not result.errlines
assert not result.stderr.str()
stdout = result.stdout.str()
# Make sure the latest failing test runs and then continues.
@ -91,7 +90,7 @@ def test_fail_and_continue_with_stepwise(stepwise_testdir):
def test_run_with_skip_option(stepwise_testdir):
result = stepwise_testdir.runpytest('-v', '--strict', '--stepwise', '--skip',
'--fail', '--fail-last')
assert not result.errlines
assert not result.stderr.str()
stdout = result.stdout.str()
# Make sure first fail is ignore and second fail stops the test run.
@ -104,7 +103,7 @@ def test_run_with_skip_option(stepwise_testdir):
def test_fail_on_errors(error_testdir):
result = error_testdir.runpytest('-v', '--strict', '--stepwise')
assert not result.errlines
assert not result.stderr.str()
stdout = result.stdout.str()
assert 'test_error ERROR' in stdout
@ -114,7 +113,7 @@ def test_fail_on_errors(error_testdir):
def test_change_testfile(stepwise_testdir):
result = stepwise_testdir.runpytest('-v', '--strict', '--stepwise', '--fail',
'test_stepwise.py')
assert not result.errlines
assert not result.stderr.str()
stdout = result.stdout.str()
assert 'test_fail_on_flag FAILED' in stdout
@ -123,7 +122,7 @@ def test_change_testfile(stepwise_testdir):
# test to continue from does not exist in testfile_b.
result = stepwise_testdir.runpytest('-v', '--strict', '--stepwise',
'testfile_b.py')
assert not result.errlines
assert not result.stderr.str()
stdout = result.stdout.str()
assert 'test_success PASSED' in stdout