Skip to content

Commit

Permalink
Deprecate --resultlog cmdline option
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Aug 17, 2016
1 parent d3b8551 commit f25771a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,16 @@ time or change existing behaviors in order to make them less surprising/more use
Thanks `@BeyondEvil`_ for reporting `#1210`_. Thanks to `@JonathonSonesen`_ and
`@tomviner`_ for the PR.

* fix `#1372`_ no longer display the incorrect test deselection reason,
thanks `@ronnypfannschmidt`_ for the PR.
* No longer display the incorrect test deselection reason (`#1372`_).
Thanks `@ronnypfannschmidt`_ for the PR.

* The ``--resultlog`` command line option has been deprecated: it is little used
and there are more modern and better alternatives (see `#830`_).
Thanks `@nicoddemus`_ for the PR.

*

*

*

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


Expand Down
1 change: 1 addition & 0 deletions _pytest/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

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

RESULT_LOG = '--result-log is deprecated and scheduled for removal in pytest 4.0'
5 changes: 4 additions & 1 deletion _pytest/resultlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def pytest_addoption(parser):
group = parser.getgroup("terminal reporting", "resultlog plugin options")
group.addoption('--resultlog', '--result-log', action="store",
metavar="path", default=None,
help="path for machine-readable result log.")
help="DEPRECATED path for machine-readable result log.")

def pytest_configure(config):
resultlog = config.option.resultlog
Expand All @@ -22,6 +22,9 @@ def pytest_configure(config):
config._resultlog = ResultLog(config, logfile)
config.pluginmanager.register(config._resultlog)

from _pytest.deprecated import RESULT_LOG
config.warn('C1', RESULT_LOG)

def pytest_unconfigure(config):
resultlog = getattr(config, '_resultlog', None)
if resultlog:
Expand Down
4 changes: 4 additions & 0 deletions doc/en/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ This will add a property node below the testsuite node to the generated xml:
Creating resultlog format files
----------------------------------------------------

.. deprecated:: 3.0

This option is rarely used and is scheduled for removal in 4.0.

To create plain-text machine-readable result files you can issue::

pytest --resultlog=path
Expand Down
12 changes: 12 additions & 0 deletions testing/deprecated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ def pytest_logwarning(self, message):

def test_getfuncargvalue_is_deprecated(request):
pytest.deprecated_call(request.getfuncargvalue, 'tmpdir')


def test_resultlog_is_deprecated(testdir):
result = testdir.runpytest('--help')
result.stdout.fnmatch_lines(['*DEPRECATED path for machine-readable result log*'])

testdir.makepyfile('''
def test():
pass
''')
result = testdir.runpytest('--result-log=%s' % testdir.tmpdir.join('result.log'))
result.stdout.fnmatch_lines(['*--result-log is deprecated and scheduled for removal in pytest 4.0*'])

0 comments on commit f25771a

Please sign in to comment.