Skip to content

Commit

Permalink
Improve user guidance regarding --resultlog deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Aug 31, 2017
1 parent 539523c commit 3288c9a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion _pytest/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class RemovedInPytest4Warning(DeprecationWarning):

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

RESULT_LOG = '--result-log is deprecated and scheduled for removal in pytest 4.0'
RESULT_LOG = (
'--result-log is deprecated and scheduled for removal in pytest 4.0.\n'
'See https://docs.pytest.org/en/latest/usage.html#creating-resultlog-format-files for more information.'
)

MARK_INFO_ATTRIBUTE = RemovedInPytest4Warning(
"MarkInfo objects are deprecated as they contain the merged marks"
Expand Down
1 change: 1 addition & 0 deletions changelog/2739.trivial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve user guidance regarding ``--resultlog`` deprecation.
7 changes: 7 additions & 0 deletions doc/en/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ Creating resultlog format files

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

An alternative for users which still need similar functionality is to use the
`pytest-tap <https://pypi.python.org/pypi/pytest-tap>`_ plugin which provides
a stream of test data.

If you have any concerns, please don't hesitate to
`open an issue <https://github.com/pytest-dev/pytest/issues>`_.

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

pytest --resultlog=path
Expand Down
5 changes: 4 additions & 1 deletion testing/deprecated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,7 @@ 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*'])
result.stdout.fnmatch_lines([
'*--result-log is deprecated and scheduled for removal in pytest 4.0*',
'*See https://docs.pytest.org/*/usage.html#creating-resultlog-format-files for more information*',
])

3 comments on commit 3288c9a

@thebjorn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome turnaround :-) I notice you sometimes write --resultlog and sometimes --result-log..?

@nicoddemus
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are valid by design, for better or worse, heh.

@nicoddemus
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def pytest_addoption(parser):
group = parser.getgroup("terminal reporting", "resultlog plugin options")
group.addoption('--resultlog', '--result-log', action="store",
metavar="path", default=None,
help="DEPRECATED path for machine-readable result log.")

Please sign in to comment.