Closed
Description
After the deprecation of terminalreporter.writer
pytest plugin tests using pytester
are getting the deprecation warning, even tho the plugin is not using terminalreporter at all.
Using pytest version 5.3.5 it works as expected.
Tested on both Linux and Mac using the below example test.
pytest_plugins = ("pytester",)
def test_base(testdir, recwarn):
testdir.makepyfile("def test_pass(): pass")
testdir.runpytest()
print(recwarn.list[0])
assert len(recwarn) == 0
assert True
test outcome
# pytest -s -ra -v
=========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /pytest-dev/pytest-playground/tests, inifile: pytest.ini
collected 1 item
test_selenium.py::test_base =========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /tmp/pytest-of-root/pytest-5/test_base0
collected 1 item
test_base.py . [100%]
============================================================================================ 1 passed in 0.01s =============================================================================================
{message : PytestDeprecationWarning('TerminalReporter.writer attribute is deprecated, use TerminalReporter._tw instead at your own risk.\nSee https://docs.pytest.org/en/latest/deprecations.html#terminalreporter-writer for more information.'), category : 'PytestDeprecationWarning', filename : '/usr/local/lib/python3.7/site-packages/_pytest/terminal.py', lineno : 289, line : None}
FAILED
================================================================================================= FAILURES =================================================================================================
________________________________________________________________________________________________ test_base _________________________________________________________________________________________________
testdir = <Testdir local('/tmp/pytest-of-root/pytest-5/test_base0')>, recwarn = WarningsRecorder(record=True)
def test_base(testdir, recwarn):
testdir.makepyfile("def test_pass(): pass")
testdir.runpytest()
print(recwarn.list[0])
> assert len(recwarn) == 0
E assert 1 == 0
E +1
E -0
/pytest-dev/pytest-playground/tests/test_selenium.py:10: AssertionError
========================================================================================= short test summary info ==========================================================================================
FAILED test_selenium.py::test_base - assert 1 == 0
============================================================================================ 1 failed in 0.18s =============================================================================================
I'm seeing tests fail in pytest-html which only uses terminalreporter.write_sep()
in a hook, and in pytest-variables which does not use terminalreporter at all.
It's failing for both python 3.6 and 3.7. Example