Skip to content

Commit ef9dd14

Browse files
committed
Introduce pytest command as recommended entry point
Fixes #1629
1 parent 54872e9 commit ef9dd14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+273
-275
lines changed

.github/ISSUE_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ Here's a quick checklist in what to include:
44

55
- [ ] Include a detailed description of the bug or suggestion
66
- [ ] `pip list` of the virtual environment you are using
7-
- [ ] py.test and operating system versions
7+
- [ ] pytest and operating system versions
88
- [ ] Minimal example if possible

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ An example of a simple test:
3333
3434
To execute it::
3535

36-
$ py.test
36+
$ pytest
3737
======= test session starts ========
3838
platform linux -- Python 3.4.3, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
3939
collected 1 items
@@ -51,7 +51,7 @@ To execute it::
5151
test_sample.py:5: AssertionError
5252
======= 1 failed in 0.12 seconds ========
5353

54-
Due to ``py.test``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <http://pytest.org/latest/getting-started.html#our-first-test-run>`_ for more examples.
54+
Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <http://pytest.org/latest/getting-started.html#our-first-test-run>`_ for more examples.
5555

5656

5757
Features

_pytest/capture.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def _readline_workaround():
463463
464464
Pdb uses readline support where available--when not running from the Python
465465
prompt, the readline module is not imported until running the pdb REPL. If
466-
running py.test with the --pdb option this means the readline module is not
466+
running pytest with the --pdb option this means the readline module is not
467467
imported until after I/O capture has been started.
468468
469469
This is a problem for pyreadline, which is often used to implement readline

_pytest/genscript.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def pytest_namespace():
9999

100100
def freeze_includes():
101101
"""
102-
Returns a list of module names used by py.test that should be
102+
Returns a list of module names used by pytest that should be
103103
included by cx_freeze.
104104
"""
105105
result = list(_iter_all_modules(py))

_pytest/helpconfig.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def showhelp(config):
9292
tw.line()
9393
tw.line()
9494

95-
tw.line("to see available markers type: py.test --markers")
96-
tw.line("to see available fixtures type: py.test --fixtures")
95+
tw.line("to see available markers type: pytest --markers")
96+
tw.line("to see available fixtures type: pytest --fixtures")
9797
tw.line("(shown according to specified file_or_dir or current dir "
9898
"if not specified)")
9999

_pytest/hookspec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def pytest_addoption(parser):
3434
.. note::
3535
3636
This function should be implemented only in plugins or ``conftest.py``
37-
files situated at the tests root directory due to how py.test
37+
files situated at the tests root directory due to how pytest
3838
:ref:`discovers plugins during startup <pluginorder>`.
3939
4040
:arg parser: To add command line options, call

_pytest/pytester.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,10 @@ def assert_outcomes(self, passed=0, skipped=0, failed=0):
374374

375375

376376
class Testdir:
377-
"""Temporary test directory with tools to test/run py.test itself.
377+
"""Temporary test directory with tools to test/run pytest itself.
378378
379379
This is based on the ``tmpdir`` fixture but provides a number of
380-
methods which aid with testing py.test itself. Unless
380+
methods which aid with testing pytest itself. Unless
381381
:py:meth:`chdir` is used all methods will use :py:attr:`tmpdir` as
382382
current working directory.
383383
@@ -588,7 +588,7 @@ def getpathnode(self, path):
588588
"""Return the collection node of a file.
589589
590590
This is like :py:meth:`getnode` but uses
591-
:py:meth:`parseconfigure` to create the (configured) py.test
591+
:py:meth:`parseconfigure` to create the (configured) pytest
592592
Config instance.
593593
594594
:param path: A :py:class:`py.path.local` instance of the file.
@@ -656,7 +656,7 @@ def inline_genitems(self, *args):
656656
:py:class:`HookRecorder` instance.
657657
658658
This runs the :py:func:`pytest.main` function to run all of
659-
py.test inside the test process itself like
659+
pytest inside the test process itself like
660660
:py:meth:`inline_run`. However the return value is a tuple of
661661
the collection items and a :py:class:`HookRecorder` instance.
662662
@@ -669,7 +669,7 @@ def inline_run(self, *args, **kwargs):
669669
"""Run ``pytest.main()`` in-process, returning a HookRecorder.
670670
671671
This runs the :py:func:`pytest.main` function to run all of
672-
py.test inside the test process itself. This means it can
672+
pytest inside the test process itself. This means it can
673673
return a :py:class:`HookRecorder` instance which gives more
674674
detailed results from then run then can be done by matching
675675
stdout/stderr from :py:meth:`runpytest`.
@@ -755,9 +755,9 @@ def _ensure_basetemp(self, args):
755755
return args
756756

757757
def parseconfig(self, *args):
758-
"""Return a new py.test Config instance from given commandline args.
758+
"""Return a new pytest Config instance from given commandline args.
759759
760-
This invokes the py.test bootstrapping code in _pytest.config
760+
This invokes the pytest bootstrapping code in _pytest.config
761761
to create a new :py:class:`_pytest.core.PluginManager` and
762762
call the pytest_cmdline_parse hook to create new
763763
:py:class:`_pytest.config.Config` instance.
@@ -777,7 +777,7 @@ def parseconfig(self, *args):
777777
return config
778778

779779
def parseconfigure(self, *args):
780-
"""Return a new py.test configured Config instance.
780+
"""Return a new pytest configured Config instance.
781781
782782
This returns a new :py:class:`_pytest.config.Config` instance
783783
like :py:meth:`parseconfig`, but also calls the
@@ -792,7 +792,7 @@ def parseconfigure(self, *args):
792792
def getitem(self, source, funcname="test_func"):
793793
"""Return the test item for a test function.
794794
795-
This writes the source to a python file and runs py.test's
795+
This writes the source to a python file and runs pytest's
796796
collection on the resulting module, returning the test item
797797
for the requested function name.
798798
@@ -812,7 +812,7 @@ def getitem(self, source, funcname="test_func"):
812812
def getitems(self, source):
813813
"""Return all test items collected from the module.
814814
815-
This writes the source to a python file and runs py.test's
815+
This writes the source to a python file and runs pytest's
816816
collection on the resulting module, returning all test items
817817
contained within.
818818
@@ -824,7 +824,7 @@ def getmodulecol(self, source, configargs=(), withinit=False):
824824
"""Return the module collection node for ``source``.
825825
826826
This writes ``source`` to a file using :py:meth:`makepyfile`
827-
and then runs the py.test collection on it, returning the
827+
and then runs the pytest collection on it, returning the
828828
collection node for the test module.
829829
830830
:param source: The source code of the module to collect.
@@ -924,7 +924,7 @@ def _dump_lines(self, lines, fp):
924924

925925
def _getpytestargs(self):
926926
# we cannot use "(sys.executable,script)"
927-
# because on windows the script is e.g. a py.test.exe
927+
# because on windows the script is e.g. a pytest.exe
928928
return (sys.executable, _pytest_fullpath,) # noqa
929929

930930
def runpython(self, script):
@@ -939,7 +939,7 @@ def runpython_c(self, command):
939939
return self.run(sys.executable, "-c", command)
940940

941941
def runpytest_subprocess(self, *args, **kwargs):
942-
"""Run py.test as a subprocess with given arguments.
942+
"""Run pytest as a subprocess with given arguments.
943943
944944
Any plugins added to the :py:attr:`plugins` list will added
945945
using the ``-p`` command line option. Addtionally
@@ -967,9 +967,9 @@ def runpytest_subprocess(self, *args, **kwargs):
967967
return self.run(*args)
968968

969969
def spawn_pytest(self, string, expect_timeout=10.0):
970-
"""Run py.test using pexpect.
970+
"""Run pytest using pexpect.
971971
972-
This makes sure to use the right py.test and sets up the
972+
This makes sure to use the right pytest and sets up the
973973
temporary directory locations.
974974
975975
The pexpect child is returned.

_pytest/python.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2173,7 +2173,7 @@ def formatrepr(self):
21732173
available.append(name)
21742174
msg = "fixture %r not found" % (self.argname,)
21752175
msg += "\n available fixtures: %s" %(", ".join(available),)
2176-
msg += "\n use 'py.test --fixtures [testpath]' for help on them."
2176+
msg += "\n use 'pytest --fixtures [testpath]' for help on them."
21772177

21782178
return FixtureLookupErrorRepr(fspath, lineno, tblines, msg, self.argname)
21792179

_pytest/standalonetemplate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#
1818
# If you're wondering how this is created: you can create it yourself if you
1919
# have a complete pytest installation by using this command on the command-
20-
# line: ``py.test --genscript=runtests.py``.
20+
# line: ``pytest --genscript=runtests.py``.
2121

2222
sources = """
2323
@SOURCES@"""

doc/en/assert.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ following::
2424
to assert that your function returns a certain value. If this assertion fails
2525
you will see the return value of the function call::
2626

27-
$ py.test test_assert1.py
27+
$ pytest test_assert1.py
2828
======= test session starts ========
2929
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
3030
rootdir: $REGENDOC_TMPDIR, inifile:
@@ -168,7 +168,7 @@ when it encounters comparisons. For example::
168168

169169
if you run this module::
170170

171-
$ py.test test_assert2.py
171+
$ pytest test_assert2.py
172172
======= test session starts ========
173173
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
174174
rootdir: $REGENDOC_TMPDIR, inifile:
@@ -237,7 +237,7 @@ now, given this test module::
237237
you can run the test module and get the custom output defined in
238238
the conftest file::
239239

240-
$ py.test -q test_foocompare.py
240+
$ pytest -q test_foocompare.py
241241
F
242242
======= FAILURES ========
243243
_______ test_compare ________

doc/en/bash-completion.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ For global activation of all argcomplete enabled python applications run::
1818

1919
For permanent (but not global) ``pytest`` activation, use::
2020

21-
register-python-argcomplete py.test >> ~/.bashrc
21+
register-python-argcomplete pytest >> ~/.bashrc
2222

2323
For one-time activation of argcomplete for ``pytest`` only, use::
2424

25-
eval "$(register-python-argcomplete py.test)"
25+
eval "$(register-python-argcomplete pytest)"
2626

2727

2828

doc/en/builtin.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Builtin fixtures/function arguments
7777
You can ask for available builtin or project-custom
7878
:ref:`fixtures <fixtures>` by typing::
7979

80-
$ py.test -q --fixtures
80+
$ pytest -q --fixtures
8181
cache
8282
Return a cache object that can persist state between testing sessions.
8383

doc/en/cache.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Usage
1515
---------
1616

1717
The plugin provides two command line options to rerun failures from the
18-
last ``py.test`` invocation:
18+
last ``pytest`` invocation:
1919

2020
* ``--lf``, ``--last-failed`` - to only re-run the failures.
2121
* ``--ff``, ``--failed-first`` - to run the failures first and then the rest of
@@ -25,7 +25,7 @@ For cleanup (usually not needed), a ``--cache-clear`` option allows to remove
2525
all cross-session cache contents ahead of a test run.
2626

2727
Other plugins may access the `config.cache`_ object to set/get
28-
**json encodable** values between ``py.test`` invocations.
28+
**json encodable** values between ``pytest`` invocations.
2929

3030
.. note::
3131

@@ -49,7 +49,7 @@ First, let's create 50 test invocation of which only 2 fail::
4949

5050
If you run this for the first time you will see two failures::
5151

52-
$ py.test -q
52+
$ pytest -q
5353
.................F.......F........................
5454
======= FAILURES ========
5555
_______ test_num[17] ________
@@ -78,7 +78,7 @@ If you run this for the first time you will see two failures::
7878

7979
If you then run it with ``--lf``::
8080

81-
$ py.test --lf
81+
$ pytest --lf
8282
======= test session starts ========
8383
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
8484
run-last-failure: rerun last 2 failures
@@ -119,7 +119,7 @@ Now, if you run with the ``--ff`` option, all tests will be run but the first
119119
previous failures will be executed first (as can be seen from the series
120120
of ``FF`` and dots)::
121121

122-
$ py.test --ff
122+
$ pytest --ff
123123
======= test session starts ========
124124
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
125125
run-last-failure: rerun last 2 failures first
@@ -163,7 +163,7 @@ The new config.cache object
163163
Plugins or conftest.py support code can get a cached value using the
164164
pytest ``config`` object. Here is a basic example plugin which
165165
implements a :ref:`fixture` which re-uses previously created state
166-
across py.test invocations::
166+
across pytest invocations::
167167

168168
# content of test_caching.py
169169
import pytest
@@ -184,7 +184,7 @@ across py.test invocations::
184184
If you run this command once, it will take a while because
185185
of the sleep::
186186

187-
$ py.test -q
187+
$ pytest -q
188188
F
189189
======= FAILURES ========
190190
_______ test_function ________
@@ -201,7 +201,7 @@ of the sleep::
201201
If you run it a second time the value will be retrieved from
202202
the cache and this will be quick::
203203

204-
$ py.test -q
204+
$ pytest -q
205205
F
206206
======= FAILURES ========
207207
_______ test_function ________
@@ -224,7 +224,7 @@ Inspecting Cache content
224224
You can always peek at the content of the cache using the
225225
``--cache-clear`` command line option::
226226

227-
$ py.test --cache-clear
227+
$ pytest --cache-clear
228228
======= test session starts ========
229229
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
230230
rootdir: $REGENDOC_TMPDIR, inifile:
@@ -250,7 +250,7 @@ Clearing Cache content
250250
You can instruct pytest to clear all cache files and values
251251
by adding the ``--cache-clear`` option like this::
252252

253-
py.test --cache-clear
253+
pytest --cache-clear
254254

255255
This is recommended for invocations from Continous Integration
256256
servers where isolation and correctness is more important

doc/en/capture.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ There are two ways in which ``pytest`` can perform capturing:
3636

3737
You can influence output capturing mechanisms from the command line::
3838

39-
py.test -s # disable all capturing
40-
py.test --capture=sys # replace sys.stdout/stderr with in-mem files
41-
py.test --capture=fd # also point filedescriptors 1 and 2 to temp file
39+
pytest -s # disable all capturing
40+
pytest --capture=sys # replace sys.stdout/stderr with in-mem files
41+
pytest --capture=fd # also point filedescriptors 1 and 2 to temp file
4242

4343
.. _printdebugging:
4444

@@ -62,7 +62,7 @@ is that you can use print statements for debugging::
6262
and running this module will show you precisely the output
6363
of the failing function and hide the other one::
6464

65-
$ py.test
65+
$ pytest
6666
======= test session starts ========
6767
platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
6868
rootdir: $REGENDOC_TMPDIR, inifile:

doc/en/customize.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Command line options and configuration file settings
77
You can get help on command line options and values in INI-style
88
configurations files by using the general help option::
99

10-
py.test -h # prints options _and_ config file settings
10+
pytest -h # prints options _and_ config file settings
1111

1212
This will display command line and configuration file settings
1313
which were registered by installed plugins.
@@ -62,7 +62,7 @@ per-testrun information.
6262

6363
Example::
6464

65-
py.test path/to/testdir path/other/
65+
pytest path/to/testdir path/other/
6666

6767
will determine the common ancestor as ``path`` and then
6868
check for ini-files as follows::
@@ -126,9 +126,9 @@ Builtin configuration file options
126126
[pytest]
127127
addopts = --maxfail=2 -rf # exit after 2 failures, report fail info
128128
129-
issuing ``py.test test_hello.py`` actually means::
129+
issuing ``pytest test_hello.py`` actually means::
130130

131-
py.test --maxfail=2 -rf test_hello.py
131+
pytest --maxfail=2 -rf test_hello.py
132132

133133
Default is to add no options.
134134

@@ -218,7 +218,7 @@ Builtin configuration file options
218218
.. confval:: doctest_optionflags
219219

220220
One or more doctest flag names from the standard ``doctest`` module.
221-
:doc:`See how py.test handles doctests <doctest>`.
221+
:doc:`See how pytest handles doctests <doctest>`.
222222

223223
.. confval:: confcutdir
224224

0 commit comments

Comments
 (0)