Revert "logfail: Switch tests to subprocess pytest runs."
This reverts commit 09c265ddb0
.
This commit is contained in:
parent
f7c405d2f4
commit
2f8b39df1c
@ -39,26 +39,26 @@ def log_testdir(testdir):
|
|||||||
return testdir
|
return testdir
|
||||||
|
|
||||||
|
|
||||||
def test_log_debug(log_testdir):
|
def test_log_debug(testdir):
|
||||||
log_testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
def test_foo():
|
def test_foo():
|
||||||
logging.debug('foo')
|
logging.debug('foo')
|
||||||
""")
|
""")
|
||||||
res = log_testdir.runpytest('-p capturelog')
|
res = testdir.inline_run()
|
||||||
res.stdout.fnmatch_lines(['*1 passed*'])
|
res.assertoutcome(passed=1)
|
||||||
|
|
||||||
|
|
||||||
def test_log_warning(log_testdir):
|
def test_log_warning(testdir):
|
||||||
log_testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
def test_foo():
|
def test_foo():
|
||||||
logging.warning('foo')
|
logging.warning('foo')
|
||||||
""")
|
""")
|
||||||
res = log_testdir.runpytest('-p capturelog')
|
res = testdir.inline_run()
|
||||||
res.stdout.fnmatch_lines(['*1 error*'])
|
res.assertoutcome(failed=1)
|
||||||
|
|
||||||
|
|
||||||
def test_log_expected(log_testdir):
|
def test_log_expected(log_testdir):
|
||||||
@ -71,11 +71,11 @@ def test_log_expected(log_testdir):
|
|||||||
logging.error('foo')
|
logging.error('foo')
|
||||||
""")
|
""")
|
||||||
res = log_testdir.runpytest('-p capturelog')
|
res = log_testdir.runpytest('-p capturelog')
|
||||||
res.stdout.fnmatch_lines(['*1 passed*'])
|
res.stdout.fnmatch_lines(['*1 passed in*'])
|
||||||
|
|
||||||
|
|
||||||
def test_log_expected_logger(log_testdir):
|
def test_log_expected_logger(testdir):
|
||||||
log_testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
def test_foo(caplog):
|
def test_foo(caplog):
|
||||||
@ -83,24 +83,24 @@ def test_log_expected_logger(log_testdir):
|
|||||||
with caplog.atLevel(logging.ERROR, logger):
|
with caplog.atLevel(logging.ERROR, logger):
|
||||||
logging.getLogger(logger).error('foo')
|
logging.getLogger(logger).error('foo')
|
||||||
""")
|
""")
|
||||||
res = log_testdir.runpytest('-p capturelog')
|
res = testdir.inline_run()
|
||||||
res.stdout.fnmatch_lines(['*1 passed*'])
|
res.assertoutcome(passed=1)
|
||||||
|
|
||||||
|
|
||||||
def test_log_expected_wrong_level(log_testdir):
|
def test_log_expected_wrong_level(testdir):
|
||||||
log_testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
def test_foo(caplog):
|
def test_foo(caplog):
|
||||||
with caplog.atLevel(logging.ERROR):
|
with caplog.atLevel(logging.ERROR):
|
||||||
logging.critical('foo')
|
logging.critical('foo')
|
||||||
""")
|
""")
|
||||||
res = log_testdir.runpytest('-p capturelog')
|
res = testdir.inline_run()
|
||||||
res.stdout.fnmatch_lines(['*1 error*'])
|
res.assertoutcome(failed=1)
|
||||||
|
|
||||||
|
|
||||||
def test_log_expected_logger_wrong_level(log_testdir):
|
def test_log_expected_logger_wrong_level(testdir):
|
||||||
log_testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
def test_foo(caplog):
|
def test_foo(caplog):
|
||||||
@ -108,12 +108,12 @@ def test_log_expected_logger_wrong_level(log_testdir):
|
|||||||
with caplog.atLevel(logging.ERROR, logger):
|
with caplog.atLevel(logging.ERROR, logger):
|
||||||
logging.getLogger(logger).critical('foo')
|
logging.getLogger(logger).critical('foo')
|
||||||
""")
|
""")
|
||||||
res = log_testdir.runpytest('-p capturelog')
|
res = testdir.inline_run()
|
||||||
res.stdout.fnmatch_lines(['*1 error*'])
|
res.assertoutcome(failed=1)
|
||||||
|
|
||||||
|
|
||||||
def test_log_expected_wrong_logger(log_testdir):
|
def test_log_expected_wrong_logger(testdir):
|
||||||
log_testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
def test_foo(caplog):
|
def test_foo(caplog):
|
||||||
@ -121,8 +121,8 @@ def test_log_expected_wrong_logger(log_testdir):
|
|||||||
with caplog.atLevel(logging.ERROR, logger):
|
with caplog.atLevel(logging.ERROR, logger):
|
||||||
logging.error('foo')
|
logging.error('foo')
|
||||||
""")
|
""")
|
||||||
res = log_testdir.runpytest('-p capturelog')
|
res = testdir.inline_run()
|
||||||
res.stdout.fnmatch_lines(['*1 error*'])
|
res.assertoutcome(failed=1)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
Loading…
Reference in New Issue
Block a user