Skip to content

Commit f521393

Browse files
committed
Remove deprecated cmd options Fixes #1657
1 parent 0c63762 commit f521393

17 files changed

+11
-303
lines changed

_pytest/assertion/__init__.py

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

3627

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

4536
def pytest_configure(config):
4637
mode = config.getvalue("assertmode")
47-
if config.getvalue("noassert") or config.getvalue("nomagic"):
48-
mode = "plain"
4938
if mode == "rewrite":
5039
try:
5140
import ast # noqa

_pytest/genscript.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -52,46 +52,6 @@ def compress_packages(names):
5252
mapping.update(pkg_to_mapping(name))
5353
return compress_mapping(mapping)
5454

55-
def generate_script(entry, packages):
56-
data = compress_packages(packages)
57-
tmpl = py.path.local(__file__).dirpath().join('standalonetemplate.py')
58-
exe = tmpl.read()
59-
exe = exe.replace('@SOURCES@', data)
60-
exe = exe.replace('@ENTRY@', entry)
61-
return exe
62-
63-
64-
def pytest_addoption(parser):
65-
group = parser.getgroup("debugconfig")
66-
group.addoption("--genscript", action="store", default=None,
67-
dest="genscript", metavar="path",
68-
help="create standalone pytest script at given target path.")
69-
70-
def pytest_cmdline_main(config):
71-
import _pytest.config
72-
genscript = config.getvalue("genscript")
73-
if genscript:
74-
tw = _pytest.config.create_terminal_writer(config)
75-
tw.line("WARNING: usage of genscript is deprecated.",
76-
red=True)
77-
deps = ['py', '_pytest', 'pytest'] # pluggy is vendored
78-
if sys.version_info < (2,7):
79-
deps.append("argparse")
80-
tw.line("generated script will run on python2.6-python3.3++")
81-
else:
82-
tw.line("WARNING: generated script will not run on python2.6 "
83-
"due to 'argparse' dependency. Use python2.6 "
84-
"to generate a python2.6 compatible script", red=True)
85-
script = generate_script(
86-
'import pytest; raise SystemExit(pytest.cmdline.main())',
87-
deps,
88-
)
89-
genscript = py.path.local(genscript)
90-
genscript.write(script)
91-
tw.line("generated pytest standalone script: %s" % genscript,
92-
bold=True)
93-
return 0
94-
9555

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

_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
@@ -287,3 +287,6 @@ For further information, Benjamin Peterson wrote up `Behind the scenes of pytest
287287
.. versionchanged:: 2.1
288288
Introduce the ``--assert`` option. Deprecate ``--no-assert`` and
289289
``--nomagic``.
290+
291+
.. versionchanged:: 3.0
292+
Removes the ``--no-assert`` and``--nomagic`` options.

doc/en/getting-started.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Where to go next
193193
Here are a few suggestions where to go next:
194194

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

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

230-
- **Jython2.5.1 on Windows XP**: `Jython does not create command line launchers`_
231-
so ``py.test`` will not work correctly. You may install py.test on
232-
CPython and type ``py.test --genscript=mytest`` and then use
233-
``jython mytest`` to run your tests with Jython using ``pytest``.
234-
235230
:ref:`examples` for more complex examples
236231

237232
.. include:: links.inc

doc/en/goodpractices.rst

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -243,38 +243,5 @@ using the ``--pytest-args`` or ``-a`` command-line option. For example::
243243
is equivalent to running ``py.test --durations=5``.
244244

245245

246-
.. _standalone:
247-
.. _`genscript method`:
248-
249-
(deprecated) Create a pytest standalone script
250-
-----------------------------------------------
251-
252-
.. deprecated:: 2.8
253-
254-
.. note::
255-
256-
``genscript`` has been deprecated because:
257-
258-
* It cannot support plugins, rendering its usefulness extremely limited;
259-
* Tooling has become much better since ``genscript`` was introduced;
260-
* It is possible to build a zipped ``pytest`` application without the
261-
shortcomings above.
262-
263-
There's no planned version in which this command will be removed
264-
at the moment of this writing, but its use is discouraged for new
265-
applications.
266-
267-
If you are a maintainer or application developer and want people
268-
who don't deal with python much to easily run tests you may generate
269-
a standalone ``pytest`` script::
270-
271-
py.test --genscript=runtests.py
272-
273-
This generates a ``runtests.py`` script which is a fully functional basic
274-
``pytest`` script, running unchanged under Python2 and Python3.
275-
You can tell people to download the script and then e.g. run it like this::
276-
277-
python runtests.py
278-
279246

280247
.. include:: links.inc

doc/en/plugins.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ in the `pytest repository <https://github.com/pytest-dev/pytest>`_.
138138
_pytest.capture
139139
_pytest.config
140140
_pytest.doctest
141-
_pytest.genscript
142141
_pytest.helpconfig
143142
_pytest.junitxml
144143
_pytest.mark

doc/en/test/plugin/genscript.rst

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

doc/en/test/plugin/helpconfig.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ command line options
1818
early-load given plugin (multi-allowed).
1919
``--trace-config``
2020
trace considerations of conftest.py files.
21-
``--nomagic``
22-
don't reinterpret asserts, no traceback cutting.
2321
``--debug``
2422
generate and show internal debugging information.
2523
``--help-config``

doc/en/test/plugin/links.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_recwarn.py
33
.. _`unittest`: unittest.html
44
.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_monkeypatch.py
5-
.. _`pytest_genscript.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.4/py/_plugin/pytest_genscript.py
65
.. _`pastebin`: pastebin.html
76
.. _`skipping`: skipping.html
8-
.. _`genscript`: genscript.html
97
.. _`plugins`: index.html
108
.. _`mark`: mark.html
119
.. _`tmpdir`: tmpdir.html

doc/en/test/plugin/terminal.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ command line options
1818
show extra test summary info as specified by chars (f)ailed, (s)skipped, (x)failed, (X)passed.
1919
``-l, --showlocals``
2020
show locals in tracebacks (disabled by default).
21-
``--report=opts``
22-
(deprecated, use -r)
2321
``--tb=style``
2422
traceback print mode (long/short/line/no).
2523
``--full-trace``

testing/test_assertion.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,8 @@ def test_hello():
474474
""")
475475
result = testdir.runpytest()
476476
assert "3 == 4" in result.stdout.str()
477-
off_options = (("--no-assert",),
478-
("--nomagic",),
479-
("--no-assert", "--nomagic"),
480-
("--assert=plain",),
481-
("--assert=plain", "--no-assert"),
482-
("--assert=plain", "--nomagic"),
483-
("--assert=plain", "--no-assert", "--nomagic"))
484-
for opt in off_options:
485-
result = testdir.runpytest_subprocess(*opt)
486-
assert "3 == 4" not in result.stdout.str()
477+
result = testdir.runpytest_subprocess("--assert=plain")
478+
assert "3 == 4" not in result.stdout.str()
487479

488480
def test_old_assert_mode(testdir):
489481
testdir.makepyfile("""
@@ -559,7 +551,7 @@ def test_warn_missing(testdir):
559551
result.stderr.fnmatch_lines([
560552
"*WARNING*assert statements are not executed*",
561553
])
562-
result = testdir.run(sys.executable, "-OO", "-m", "pytest", "--no-assert")
554+
result = testdir.run(sys.executable, "-OO", "-m", "pytest")
563555
result.stderr.fnmatch_lines([
564556
"*WARNING*assert statements are not executed*",
565557
])

testing/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def test_f2(): assert 0
365365
""")
366366

367367
for opts in ([], ['-l'], ['-s'], ['--tb=no'], ['--tb=short'],
368-
['--tb=long'], ['--fulltrace'], ['--nomagic'],
368+
['--tb=long'], ['--fulltrace'],
369369
['--traceconfig'], ['-v'], ['-v', '-v']):
370370
runfiletest(opts + [path])
371371

0 commit comments

Comments
 (0)