2016-07-23 22:56:04 +08:00
|
|
|
import pytest
|
2019-06-13 05:49:51 +08:00
|
|
|
from _pytest import deprecated
|
2016-07-23 22:56:04 +08:00
|
|
|
|
|
|
|
|
2018-09-02 08:58:48 +08:00
|
|
|
@pytest.mark.filterwarnings("default")
|
2016-08-17 07:22:15 +08:00
|
|
|
def test_resultlog_is_deprecated(testdir):
|
2018-05-23 22:48:46 +08:00
|
|
|
result = testdir.runpytest("--help")
|
|
|
|
result.stdout.fnmatch_lines(["*DEPRECATED path for machine-readable result log*"])
|
2016-08-17 07:22:15 +08:00
|
|
|
|
2018-05-23 22:48:46 +08:00
|
|
|
testdir.makepyfile(
|
|
|
|
"""
|
2016-08-17 07:22:15 +08:00
|
|
|
def test():
|
|
|
|
pass
|
2018-05-23 22:48:46 +08:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
result = testdir.runpytest("--result-log=%s" % testdir.tmpdir.join("result.log"))
|
|
|
|
result.stdout.fnmatch_lines(
|
|
|
|
[
|
2019-06-12 08:19:30 +08:00
|
|
|
"*--result-log is deprecated and scheduled for removal in pytest 6.0*",
|
2018-11-23 07:14:53 +08:00
|
|
|
"*See https://docs.pytest.org/en/latest/deprecations.html#result-log-result-log for more information*",
|
2018-05-23 22:48:46 +08:00
|
|
|
]
|
|
|
|
)
|
2017-11-15 23:48:08 +08:00
|
|
|
|
|
|
|
|
2017-12-01 04:34:53 +08:00
|
|
|
def test_terminal_reporter_writer_attr(pytestconfig):
|
|
|
|
"""Check that TerminalReporter._tw is also available as 'writer' (#2984)
|
|
|
|
This attribute is planned to be deprecated in 3.4.
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
import xdist # noqa
|
2018-05-23 22:48:46 +08:00
|
|
|
|
|
|
|
pytest.skip("xdist workers disable the terminal reporter plugin")
|
2017-12-01 04:34:53 +08:00
|
|
|
except ImportError:
|
|
|
|
pass
|
2018-05-23 22:48:46 +08:00
|
|
|
terminal_reporter = pytestconfig.pluginmanager.get_plugin("terminalreporter")
|
2017-12-01 04:34:53 +08:00
|
|
|
assert terminal_reporter.writer is terminal_reporter._tw
|
|
|
|
|
|
|
|
|
2019-06-13 05:49:51 +08:00
|
|
|
@pytest.mark.parametrize("plugin", deprecated.DEPRECATED_EXTERNAL_PLUGINS)
|
2018-12-12 06:02:36 +08:00
|
|
|
@pytest.mark.filterwarnings("default")
|
2019-06-13 05:49:51 +08:00
|
|
|
def test_external_plugins_integrated(testdir, plugin):
|
|
|
|
testdir.syspathinsert()
|
|
|
|
testdir.makepyfile(**{plugin: ""})
|
|
|
|
|
|
|
|
with pytest.warns(pytest.PytestConfigWarning):
|
|
|
|
testdir.parseconfig("-p", plugin)
|