Skip to content

Commit

Permalink
Simplify test assertions a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jan 17, 2018
1 parent de42d42 commit cee35bb
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions testing/logging/test_reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,7 @@ def test_log_cli(request):
'test_log_cli_level.py*This log message will be shown',
'PASSED', # 'PASSED' on its own line because the log message prints a new line
])
for line in result.outlines:
try:
assert "This log message won't be shown" in line
pytest.fail("A log message was shown and it shouldn't have been")
except AssertionError:
continue
assert "This log message won't be shown" not in result.stdout.str()

# make sure that that we get a '0' exit code for the testsuite
assert result.ret == 0
Expand All @@ -234,12 +229,7 @@ def test_log_cli(request):
'test_log_cli_level.py* This log message will be shown',
'PASSED', # 'PASSED' on its own line because the log message prints a new line
])
for line in result.outlines:
try:
assert "This log message won't be shown" in line
pytest.fail("A log message was shown and it shouldn't have been")
except AssertionError:
continue
assert "This log message won't be shown" not in result.stdout.str()

# make sure that that we get a '0' exit code for the testsuite
assert result.ret == 0
Expand Down Expand Up @@ -270,12 +260,7 @@ def test_log_cli(request):
'test_log_cli_ini_level.py* This log message will be shown',
'PASSED', # 'PASSED' on its own line because the log message prints a new line
])
for line in result.outlines:
try:
assert "This log message won't be shown" in line
pytest.fail("A log message was shown and it shouldn't have been")
except AssertionError:
continue
assert "This log message won't be shown" not in result.stdout.str()

# make sure that that we get a '0' exit code for the testsuite
assert result.ret == 0
Expand Down

0 comments on commit cee35bb

Please sign in to comment.