Skip to content

Commit f25771a

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

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

CHANGELOG.rst

+11-2
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,16 @@ time or change existing behaviors in order to make them less surprising/more use
274274
Thanks `@BeyondEvil`_ for reporting `#1210`_. Thanks to `@JonathonSonesen`_ and
275275
`@tomviner`_ for the PR.
276276

277-
* fix `#1372`_ no longer display the incorrect test deselection reason,
278-
thanks `@ronnypfannschmidt`_ for the PR.
277+
* No longer display the incorrect test deselection reason (`#1372`_).
278+
Thanks `@ronnypfannschmidt`_ for the PR.
279+
280+
* The ``--resultlog`` command line option has been deprecated: it is little used
281+
and there are more modern and better alternatives (see `#830`_).
282+
Thanks `@nicoddemus`_ for the PR.
283+
284+
*
285+
286+
*
279287

280288
*
281289

@@ -377,6 +385,7 @@ time or change existing behaviors in order to make them less surprising/more use
377385
.. _#607: https://github.com/pytest-dev/pytest/issues/607
378386
.. _#634: https://github.com/pytest-dev/pytest/issues/634
379387
.. _#717: https://github.com/pytest-dev/pytest/issues/717
388+
.. _#830: https://github.com/pytest-dev/pytest/issues/830
380389
.. _#925: https://github.com/pytest-dev/pytest/issues/925
381390

382391

_pytest/deprecated.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919

2020
GETFUNCARGVALUE = "use of getfuncargvalue is deprecated, use getfixturevalue"
2121

22+
RESULT_LOG = '--result-log is deprecated and scheduled for removal in pytest 4.0'

_pytest/resultlog.py

+4-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
@@ -22,6 +22,9 @@ def pytest_configure(config):
2222
config._resultlog = ResultLog(config, logfile)
2323
config.pluginmanager.register(config._resultlog)
2424

25+
from _pytest.deprecated import RESULT_LOG
26+
config.warn('C1', RESULT_LOG)
27+
2528
def pytest_unconfigure(config):
2629
resultlog = getattr(config, '_resultlog', None)
2730
if resultlog:

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)