diff options
author | Florian Bruhin <git@the-compiler.org> | 2015-09-09 07:40:24 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2015-09-09 07:58:14 +0200 |
commit | 09c265ddb0f512451df8c9f217d0810c3f06c2b7 (patch) | |
tree | c6fee0829b0b6804058850e9015f1319371ee1f6 | |
parent | f7e40f73abc59798a02392f262dedf206ff81a7d (diff) | |
download | qutebrowser-09c265ddb0f512451df8c9f217d0810c3f06c2b7.tar.gz qutebrowser-09c265ddb0f512451df8c9f217d0810c3f06c2b7.zip |
logfail: Switch tests to subprocess pytest runs.
It seems they're much more reliable this way.
-rw-r--r-- | tests/helpers/test_logfail.py | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/helpers/test_logfail.py b/tests/helpers/test_logfail.py index 61da35e5f..56b0cd9cf 100644 --- a/tests/helpers/test_logfail.py +++ b/tests/helpers/test_logfail.py @@ -41,26 +41,26 @@ def log_testdir(testdir): return testdir -def test_log_debug(testdir): - testdir.makepyfile(""" +def test_log_debug(log_testdir): + log_testdir.makepyfile(""" import logging def test_foo(): logging.debug('foo') """) - res = testdir.inline_run() - res.assertoutcome(passed=1) + res = log_testdir.runpytest('-p capturelog') + res.stdout.fnmatch_lines(['*1 passed*']) -def test_log_warning(testdir): - testdir.makepyfile(""" +def test_log_warning(log_testdir): + log_testdir.makepyfile(""" import logging def test_foo(): logging.warning('foo') """) - res = testdir.inline_run() - res.assertoutcome(failed=1) + res = log_testdir.runpytest('-p capturelog') + res.stdout.fnmatch_lines(['*1 error*']) def test_log_expected(log_testdir): @@ -73,11 +73,11 @@ def test_log_expected(log_testdir): logging.error('foo') """) res = log_testdir.runpytest('-p capturelog') - res.stdout.fnmatch_lines(['*1 passed in*']) + res.stdout.fnmatch_lines(['*1 passed*']) -def test_log_expected_logger(testdir): - testdir.makepyfile(""" +def test_log_expected_logger(log_testdir): + log_testdir.makepyfile(""" import logging def test_foo(caplog): @@ -85,24 +85,24 @@ def test_log_expected_logger(testdir): with caplog.atLevel(logging.ERROR, logger): logging.getLogger(logger).error('foo') """) - res = testdir.inline_run() - res.assertoutcome(passed=1) + res = log_testdir.runpytest('-p capturelog') + res.stdout.fnmatch_lines(['*1 passed*']) -def test_log_expected_wrong_level(testdir): - testdir.makepyfile(""" +def test_log_expected_wrong_level(log_testdir): + log_testdir.makepyfile(""" import logging def test_foo(caplog): with caplog.atLevel(logging.ERROR): logging.critical('foo') """) - res = testdir.inline_run() - res.assertoutcome(failed=1) + res = log_testdir.runpytest('-p capturelog') + res.stdout.fnmatch_lines(['*1 error*']) -def test_log_expected_logger_wrong_level(testdir): - testdir.makepyfile(""" +def test_log_expected_logger_wrong_level(log_testdir): + log_testdir.makepyfile(""" import logging def test_foo(caplog): @@ -110,12 +110,12 @@ def test_log_expected_logger_wrong_level(testdir): with caplog.atLevel(logging.ERROR, logger): logging.getLogger(logger).critical('foo') """) - res = testdir.inline_run() - res.assertoutcome(failed=1) + res = log_testdir.runpytest('-p capturelog') + res.stdout.fnmatch_lines(['*1 error*']) -def test_log_expected_wrong_logger(testdir): - testdir.makepyfile(""" +def test_log_expected_wrong_logger(log_testdir): + log_testdir.makepyfile(""" import logging def test_foo(caplog): @@ -123,8 +123,8 @@ def test_log_expected_wrong_logger(testdir): with caplog.atLevel(logging.ERROR, logger): logging.error('foo') """) - res = testdir.inline_run() - res.assertoutcome(failed=1) + res = log_testdir.runpytest('-p capturelog') + res.stdout.fnmatch_lines(['*1 error*']) @pytest.fixture |