Skip to content

Commit db9b3e9

Browse files
authored
Merge pull request #1677 from nicoddemus/remove_cmd_options
Remove cmd options
2 parents 68bed00 + 7239f36 commit db9b3e9

20 files changed

+73
-432
lines changed

CHANGELOG.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,22 @@
1616

1717
*
1818

19+
**Incompatible changes**
20+
21+
* Removing the following deprecated commandline options
22+
23+
* ``--genscript``
24+
* ``--no-assert``
25+
* ``--nomagic``
26+
* ``--report``
27+
28+
Thanks to `@RedBeardCode`_ for the PR(`#1664`_)
29+
30+
1931
.. _#607: https://github.com/pytest-dev/pytest/issues/607
2032
.. _#1519: https://github.com/pytest-dev/pytest/pull/1519
33+
.. _#1664: https://github.com/pytest-dev/pytest/pull/1664
34+
2135

2236
2.10.0.dev1
2337
===========
@@ -146,7 +160,6 @@
146160
* Add proposal to docs for a new feature that enables users to combine multiple
147161
fixtures into one. Thanks to `@hpk42`_ and `@hackebrot`_.
148162

149-
*
150163

151164
.. _#1580: https://github.com/pytest-dev/pytest/pull/1580
152165
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605

_pytest/assertion/__init__.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ def pytest_addoption(parser):
2525
'rewrite' (the default) rewrites assert
2626
statements in test modules on import to
2727
provide assert expression information. """)
28-
group.addoption('--no-assert',
29-
action="store_true",
30-
default=False,
31-
dest="noassert",
32-
help="DEPRECATED equivalent to --assert=plain")
33-
group.addoption('--nomagic', '--no-magic',
34-
action="store_true",
35-
default=False,
36-
help="DEPRECATED equivalent to --assert=plain")
3728

3829

3930
class AssertionState:
@@ -48,10 +39,6 @@ def __init__(self, config, mode):
4839
def pytest_load_initial_conftests(early_config, parser, args):
4940
ns, ns_unknown_args = parser.parse_known_and_unknown_args(args)
5041
mode = ns.assertmode
51-
no_assert = ns.noassert
52-
no_magic = ns.nomagic
53-
if no_assert or no_magic:
54-
mode = "plain"
5542
if mode == "rewrite":
5643
try:
5744
import ast # noqa

_pytest/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ class UsageError(Exception):
6464

6565
default_plugins = (
6666
"mark main terminal runner python pdb unittest capture skipping "
67-
"tmpdir monkeypatch recwarn pastebin helpconfig nose assertion genscript "
68-
"junitxml resultlog doctest cacheprovider setuponly setupplan").split()
67+
"tmpdir monkeypatch recwarn pastebin helpconfig nose assertion "
68+
"junitxml resultlog doctest cacheprovider freeze_support "
69+
"setuponly setupplan").split()
6970

7071
builtin_plugins = set(default_plugins)
7172
builtin_plugins.add("pytester")

_pytest/freeze_support.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""
2+
Provides a function to report all internal modules for using freezing tools
3+
pytest
4+
"""
5+
6+
def pytest_namespace():
7+
return {'freeze_includes': freeze_includes}
8+
9+
10+
def freeze_includes():
11+
"""
12+
Returns a list of module names used by py.test that should be
13+
included by cx_freeze.
14+
"""
15+
import py
16+
import _pytest
17+
result = list(_iter_all_modules(py))
18+
result += list(_iter_all_modules(_pytest))
19+
return result
20+
21+
22+
def _iter_all_modules(package, prefix=''):
23+
"""
24+
Iterates over the names of all modules that can be found in the given
25+
package, recursively.
26+
Example:
27+
_iter_all_modules(_pytest) ->
28+
['_pytest.assertion.newinterpret',
29+
'_pytest.capture',
30+
'_pytest.core',
31+
...
32+
]
33+
"""
34+
import os
35+
import pkgutil
36+
if type(package) is not str:
37+
path, prefix = package.__path__[0], package.__name__ + '.'
38+
else:
39+
path = package
40+
for _, name, is_package in pkgutil.iter_modules([path]):
41+
if is_package:
42+
for m in _iter_all_modules(os.path.join(path, name), prefix=name + '.'):
43+
yield prefix + m
44+
else:
45+
yield prefix + name

_pytest/genscript.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

_pytest/standalonetemplate.py

Lines changed: 0 additions & 89 deletions
This file was deleted.

_pytest/terminal.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ def pytest_addoption(parser):
2727
group._addoption('-l', '--showlocals',
2828
action="store_true", dest="showlocals", default=False,
2929
help="show locals in tracebacks (disabled by default).")
30-
group._addoption('--report',
31-
action="store", dest="report", default=None, metavar="opts",
32-
help="(deprecated, use -r)")
3330
group._addoption('--tb', metavar="style",
3431
action="store", dest="tbstyle", default='auto',
3532
choices=['auto', 'long', 'short', 'no', 'line', 'native'],
@@ -54,17 +51,6 @@ def mywriter(tags, args):
5451

5552
def getreportopt(config):
5653
reportopts = ""
57-
optvalue = config.option.report
58-
if optvalue:
59-
py.builtin.print_("DEPRECATED: use -r instead of --report option.",
60-
file=sys.stderr)
61-
if optvalue:
62-
for setting in optvalue.split(","):
63-
setting = setting.strip()
64-
if setting == "skipped":
65-
reportopts += "s"
66-
elif setting == "xfailed":
67-
reportopts += "x"
6854
reportchars = config.option.reportchars
6955
if reportchars:
7056
for char in reportchars:

doc/en/assert.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,3 +314,6 @@ For further information, Benjamin Peterson wrote up `Behind the scenes of pytest
314314
.. versionchanged:: 2.1
315315
Introduce the ``--assert`` option. Deprecate ``--no-assert`` and
316316
``--nomagic``.
317+
318+
.. versionchanged:: 3.0
319+
Removes the ``--no-assert`` and``--nomagic`` options.

0 commit comments

Comments
 (0)