Skip to content

Commit

Permalink
Use 'pytest' instead of 'py.test' in examples and configuration (#193)
Browse files Browse the repository at this point in the history
'pytest' is the recommended command since version 3.0. The command
was called 'py.test' only for historical reasons:

https://docs.pytest.org/en/latest/faq.html#why-can-i-use-both-pytest-and-py-test-commands
  • Loading branch information
nicoddemus authored and theacodes committed May 16, 2019
1 parent a493eed commit ccf8b5f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions nox/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ def run(self, *args, env=None, **kwargs):
Commands must be specified as a list of strings, for example::
session.run('py.test', '-k', 'fast', 'tests/')
session.run('pytest', '-k', 'fast', 'tests/')
session.run('flake8', '--import-order-style=google')
You **can not** just pass everything as one string. For example, this
**will not work**::
session.run('py.test -k fast tests/')
session.run('pytest -k fast tests/')
You can set environment variables for the command using ``env``::
Expand All @@ -152,11 +152,11 @@ def run(self, *args, env=None, **kwargs):
env={'SOME_ENV': 'Hello'})
You can also tell nox to treat non-zero exit codes as success using
``success_codes``. For example, if you wanted to treat the ``py.test``
``success_codes``. For example, if you wanted to treat the ``pytest``
"tests discovered, but none selected" error as success::
session.run(
'py.test', '-k', 'not slow',
'pytest', '-k', 'not slow',
success_codes=[0, 5])
:param env: A dictionary of environment variables to expose to the
Expand Down Expand Up @@ -214,7 +214,7 @@ def install(self, *args, **kwargs):
To install packages directly::
session.install('py.test')
session.install('pytest')
session.install('requests', 'mock')
session.install('requests[security]==2.9.1')
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def tests(session):
session.install("-e", ".[tox_to_nox]")
tests = session.posargs or ["tests/"]
session.run(
"py.test", "--cov=nox", "--cov-config", ".coveragerc", "--cov-report=", *tests
"pytest", "--cov=nox", "--cov-config", ".coveragerc", "--cov-report=", *tests
)
session.notify("cover")

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""py.test shared testing configuration.
"""pytest shared testing configuration.
This monkey-patches ``mock`` as ``unittest.mock`` for Python 2.7.
"""
Expand Down

0 comments on commit ccf8b5f

Please sign in to comment.