Skip to content

Commit 2408f19

Browse files
committed
Deprecate --resultlog cmdline option
Fix pytest-dev#830
1 parent d3b8551 commit 2408f19

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

_pytest/resultlog.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def pytest_addoption(parser):
99
group = parser.getgroup("terminal reporting", "resultlog plugin options")
1010
group.addoption('--resultlog', '--result-log', action="store",
1111
metavar="path", default=None,
12-
help="path for machine-readable result log.")
12+
help="DEPRECATED path for machine-readable result log.")
1313

1414
def pytest_configure(config):
1515
resultlog = config.option.resultlog
@@ -21,6 +21,8 @@ def pytest_configure(config):
2121
logfile = open(resultlog, 'w', 1) # line buffered
2222
config._resultlog = ResultLog(config, logfile)
2323
config.pluginmanager.register(config._resultlog)
24+
config.warn('C1', '--result-log is deprecated and scheduled for '
25+
'removal in pytest 4.0')
2426

2527
def pytest_unconfigure(config):
2628
resultlog = getattr(config, '_resultlog', None)

doc/en/usage.rst

+4
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ This will add a property node below the testsuite node to the generated xml:
251251
Creating resultlog format files
252252
----------------------------------------------------
253253

254+
.. deprecated:: 3.0
255+
256+
This option is rarely used and is scheduled for removal in 4.0.
257+
254258
To create plain-text machine-readable result files you can issue::
255259

256260
pytest --resultlog=path

testing/deprecated_test.py

+12
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,15 @@ def pytest_logwarning(self, message):
5353

5454
def test_getfuncargvalue_is_deprecated(request):
5555
pytest.deprecated_call(request.getfuncargvalue, 'tmpdir')
56+
57+
58+
def test_resultlog_is_deprecated(testdir):
59+
result = testdir.runpytest('--help')
60+
result.stdout.fnmatch_lines(['*DEPRECATED path for machine-readable result log*'])
61+
62+
testdir.makepyfile('''
63+
def test():
64+
pass
65+
''')
66+
result = testdir.runpytest('--result-log=%s' % testdir.tmpdir.join('result.log'))
67+
result.stdout.fnmatch_lines(['*--result-log is deprecated and scheduled for removal in pytest 4.0*'])

0 commit comments

Comments
 (0)