Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated cmd options Fixes #1657 #1664

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@

*

*
**Incompatible changes**

* Removing the following deprecated commandline options

* genscript
* no-assert
* nomagic
* report

Thanks to `@RedBeardCode`_ for the PR(`#1664`_)



.. _#1580: https://github.com/pytest-dev/pytest/pull/1580
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605
Expand All @@ -47,6 +58,7 @@
.. _#1553: https://github.com/pytest-dev/pytest/issues/1553
.. _#1626: https://github.com/pytest-dev/pytest/pull/1626
.. _#1503: https://github.com/pytest-dev/pytest/issues/1503
.. _#1664: https://github.com/pytest-dev/pytest/pull/1664

.. _@graingert: https://github.com/graingert
.. _@taschini: https://github.com/taschini
Expand Down
11 changes: 0 additions & 11 deletions _pytest/assertion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ def pytest_addoption(parser):
'rewrite' (the default) rewrites assert
statements in test modules on import to
provide assert expression information. """)
group.addoption('--no-assert',
action="store_true",
default=False,
dest="noassert",
help="DEPRECATED equivalent to --assert=plain")
group.addoption('--nomagic', '--no-magic',
action="store_true",
default=False,
help="DEPRECATED equivalent to --assert=plain")


class AssertionState:
Expand All @@ -44,8 +35,6 @@ def __init__(self, config, mode):

def pytest_configure(config):
mode = config.getvalue("assertmode")
if config.getvalue("noassert") or config.getvalue("nomagic"):
mode = "plain"
if mode == "rewrite":
try:
import ast # noqa
Expand Down
4 changes: 2 additions & 2 deletions _pytest/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class UsageError(Exception):

default_plugins = (
"mark main terminal runner python pdb unittest capture skipping "
"tmpdir monkeypatch recwarn pastebin helpconfig nose assertion genscript "
"junitxml resultlog doctest cacheprovider").split()
"tmpdir monkeypatch recwarn pastebin helpconfig nose assertion "
"junitxml resultlog doctest cacheprovider freeze_support").split()

builtin_plugins = set(default_plugins)
builtin_plugins.add("pytester")
Expand Down
45 changes: 45 additions & 0 deletions _pytest/freeze_support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""
Provides a function to report all internal modules for using freezing tools
pytest
"""

def pytest_namespace():
return {'freeze_includes': freeze_includes}


def freeze_includes():
"""
Returns a list of module names used by py.test that should be
included by cx_freeze.
"""
import py
import _pytest
result = list(_iter_all_modules(py))
result += list(_iter_all_modules(_pytest))
return result


def _iter_all_modules(package, prefix=''):
"""
Iterates over the names of all modules that can be found in the given
package, recursively.
Example:
_iter_all_modules(_pytest) ->
['_pytest.assertion.newinterpret',
'_pytest.capture',
'_pytest.core',
...
]
"""
import os
import pkgutil
if type(package) is not str:
path, prefix = package.__path__[0], package.__name__ + '.'
else:
path = package
for _, name, is_package in pkgutil.iter_modules([path]):
if is_package:
for m in _iter_all_modules(os.path.join(path, name), prefix=name + '.'):
yield prefix + m
else:
yield prefix + name
132 changes: 0 additions & 132 deletions _pytest/genscript.py

This file was deleted.

89 changes: 0 additions & 89 deletions _pytest/standalonetemplate.py

This file was deleted.

14 changes: 0 additions & 14 deletions _pytest/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ def pytest_addoption(parser):
group._addoption('-l', '--showlocals',
action="store_true", dest="showlocals", default=False,
help="show locals in tracebacks (disabled by default).")
group._addoption('--report',
action="store", dest="report", default=None, metavar="opts",
help="(deprecated, use -r)")
group._addoption('--tb', metavar="style",
action="store", dest="tbstyle", default='auto',
choices=['auto', 'long', 'short', 'no', 'line', 'native'],
Expand All @@ -54,17 +51,6 @@ def mywriter(tags, args):

def getreportopt(config):
reportopts = ""
optvalue = config.option.report
if optvalue:
py.builtin.print_("DEPRECATED: use -r instead of --report option.",
file=sys.stderr)
if optvalue:
for setting in optvalue.split(","):
setting = setting.strip()
if setting == "skipped":
reportopts += "s"
elif setting == "xfailed":
reportopts += "x"
reportchars = config.option.reportchars
if reportchars:
for char in reportchars:
Expand Down
3 changes: 3 additions & 0 deletions doc/en/assert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,6 @@ For further information, Benjamin Peterson wrote up `Behind the scenes of pytest
.. versionchanged:: 2.1
Introduce the ``--assert`` option. Deprecate ``--no-assert`` and
``--nomagic``.

.. versionchanged:: 3.0
Removes the ``--no-assert`` and``--nomagic`` options.
7 changes: 1 addition & 6 deletions doc/en/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Where to go next
Here are a few suggestions where to go next:

* :ref:`cmdline` for command line invocation examples
* :ref:`good practices <goodpractices>` for virtualenv, test layout, genscript support
* :ref:`good practices <goodpractices>` for virtualenv, test layout
* :ref:`fixtures` for providing a functional baseline to your tests
* :ref:`apiref` for documentation and examples on using ``pytest``
* :ref:`plugins` managing and writing plugins
Expand Down Expand Up @@ -227,11 +227,6 @@ py.test not found on Windows despite installation?

.. _`Jython does not create command line launchers`: http://bugs.jython.org/issue1491

- **Jython2.5.1 on Windows XP**: `Jython does not create command line launchers`_
so ``py.test`` will not work correctly. You may install py.test on
CPython and type ``py.test --genscript=mytest`` and then use
``jython mytest`` to run your tests with Jython using ``pytest``.

:ref:`examples` for more complex examples

.. include:: links.inc
Loading