diff options
author | Vinay Calastry <vinay.calastry@gmail.com> | 2019-12-10 19:47:51 -0800 |
---|---|---|
committer | Vinay Calastry <vinay.calastry@gmail.com> | 2019-12-14 16:46:30 -0800 |
commit | afbaee7649c7b2c7a6167e47aea8fb0f46444755 (patch) | |
tree | f76fb54b3d03a48da0b32aabd092dfb7147a22fe /testing/deprecated_test.py | |
parent | 1ef29ab5480ebcdcc5597ce5a34bc4ab7ed44912 (diff) | |
download | pytest-afbaee7649c7b2c7a6167e47aea8fb0f46444755.tar.gz |
Deprecate --no-print-logs option
Diffstat (limited to 'testing/deprecated_test.py')
-rw-r--r-- | testing/deprecated_test.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index 59cb69a00..c7ca80cbd 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -90,3 +90,44 @@ def test_node_direct_ctor_warning(): nodes.Node(name="test", config=ms, session=ms, nodeid="None") assert w[0].lineno == inspect.currentframe().f_lineno - 1 assert w[0].filename == __file__ + + +def assert_no_print_logs(testdir, args): + result = testdir.runpytest(*args) + result.stdout.fnmatch_lines( + [ + "*--no-print-logs is deprecated and scheduled for removal in pytest 6.0*", + "*Please use --show-capture instead.*", + ] + ) + + +@pytest.mark.filterwarnings("default") +def test_noprintlogs_is_deprecated_cmdline(testdir): + testdir.makepyfile( + """ + def test_foo(): + pass + """ + ) + + assert_no_print_logs(testdir, ("--no-print-logs",)) + + +@pytest.mark.filterwarnings("default") +def test_noprintlogs_is_deprecated_ini(testdir): + testdir.makeini( + """ + [pytest] + log_print=False + """ + ) + + testdir.makepyfile( + """ + def test_foo(): + pass + """ + ) + + assert_no_print_logs(testdir, ()) |