Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
799bccc
Fix sphinx code-block types (syntax highlighting) in two docs
gyermolenko Feb 13, 2019
5cf58a9
Revert '$' changes to not trigger regendoc
gyermolenko Feb 15, 2019
6e1ee08
Fix sphinx code-block types for remaining rst docs
gyermolenko Feb 15, 2019
9cb504c
Add same environments to Azure as have in AppVeyor, except py37-freeze
nicoddemus Feb 13, 2019
214c331
Travis: use pypy from Xenial, add pypy3
blueyed Feb 9, 2019
bf6dcd6
Merge pull request #4757 from blueyed/pypy
nicoddemus Feb 18, 2019
c8a87e4
Merge pull request #4783 from gyermolenko/fix_syntax_highlighting_for…
Zac-HD Feb 19, 2019
2ef3cb2
Recommend use venv instead of virtualenv
discdiver Feb 20, 2019
da5dec8
update links for virtualenv -> venv
discdiver Feb 20, 2019
fa65b71
Merge pull request #1 from discdiver/discdiver-patch-1
discdiver Feb 20, 2019
6b66179
update links.inc to include both venv and virtualenv
discdiver Feb 21, 2019
cfaa8bb
recommend venv or virtualenv, depending on python version
discdiver Feb 21, 2019
ba2a432
Mention that virtualenv should be used for Python 3.4 as well
nicoddemus Feb 21, 2019
e75915b
Revert recommending virtualenv for Python 3.4
nicoddemus Feb 21, 2019
e1aeb69
Fix linting
nicoddemus Feb 21, 2019
4ee10d2
Merge pull request #4813 from discdiver/patch-1
nicoddemus Feb 21, 2019
da30596
Merge pull request #4793 from nicoddemus/azure-include-more-envs
asottile Feb 21, 2019
b26b731
Logging: Make pytest_runtest_logreport() available for logging
Feb 20, 2019
5b35241
Merge pull request #4812 from mitzkia/logging_from_runtest_logreport
nicoddemus Feb 22, 2019
a68f4fd
Fix test failures after pluggy 1.8 release
nicoddemus Feb 22, 2019
0ca1f6e
Merge branch 'fix-new-pluggy' into merge-master-into-features
nicoddemus Feb 22, 2019
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
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ matrix:
jobs:
include:
# Coverage tracking is slow with pypy, skip it.
- env: TOXENV=pypy PYTEST_NO_COVERAGE=1
python: 'pypy-5.4'
dist: trusty
- env: TOXENV=pypy-xdist PYTEST_NO_COVERAGE=1
python: 'pypy2.7-6.0'
- env: TOXENV=pypy3-xdist PYTEST_NO_COVERAGE=1
python: 'pypy3.5-6.0'

- env: TOXENV=py34-xdist
python: '3.4'
- env: TOXENV=py35-xdist
Expand Down
62 changes: 59 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ trigger:

variables:
PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml"
python.needs_vc: False
python.exe: "python"

jobs:

Expand All @@ -15,6 +17,26 @@ jobs:
py27:
python.version: '2.7'
tox.env: 'py27'
py27-xdist:
python.version: '2.7'
tox.env: 'py27-xdist'
py27-numpy/nobyte:
python.version: '2.7'
tox.env: 'py27-numpy,py27-nobyte'
py27-trial:
python.version: '2.7'
tox.env: 'py27-trial'
python.needs_vc: True
py27-pluggymaster:
python.version: '2.7'
tox.env: 'pluggymaster'
pypy:
python.version: 'pypy'
tox.env: 'pypy'
python.exe: 'pypy'
py34:
python.version: '3.4'
tox.env: 'py34'
py35:
python.version: '3.5'
tox.env: 'py35'
Expand All @@ -24,18 +46,52 @@ jobs:
py37:
python.version: '3.7'
tox.env: 'py37'
maxParallel: 4
py37-linting/docs/doctesting:
python.version: '3.7'
tox.env: 'linting,docs,doctesting'
py37-xdist:
python.version: '3.7'
tox.env: 'py37-xdist'
py37-trial/numpy:
python.version: '3.7'
tox.env: 'py37-trial,py37-numpy'
py37-pluggymaster:
python.version: '3.7'
tox.env: 'py37-pluggymaster'
maxParallel: 10

steps:
- task: UsePythonVersion@0
condition: not(startsWith(variables['python.exe'], 'pypy'))
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'

- script: python -m pip install --upgrade pip && pip install tox
- script: choco install vcpython27
condition: eq(variables['python.needs_vc'], True)
displayName: 'Install VC for py27'

- script: choco install python.pypy
condition: eq(variables['python.exe'], 'pypy')
displayName: 'Install pypy'

- script: choco install pypy3
condition: eq(variables['python.exe'], 'pypy3')
displayName: 'Install pypy3'

- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -OutFile "get-pip.py"
$(python.exe) get-pip.py
condition: startsWith(variables['python.exe'], 'pypy')
displayName: 'Install pip'

- script: $(python.exe) -m pip install --upgrade pip && $(python.exe) -m pip install tox
displayName: 'Install tox'

- script: python -m tox -e $(tox.env)
- script: $(python.exe) -m tox -e $(tox.env)
displayName: 'Run tests'

- task: PublishTestResults@2
Expand Down
1 change: 1 addition & 0 deletions changelog/4810.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Logging messages inside ``pytest_runtest_logreport()`` are now properly captured and displayed.
22 changes: 15 additions & 7 deletions doc/en/bash-completion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@ When using bash as your shell, ``pytest`` can use argcomplete
(https://argcomplete.readthedocs.io/) for auto-completion.
For this ``argcomplete`` needs to be installed **and** enabled.

Install argcomplete using::
Install argcomplete using:

sudo pip install 'argcomplete>=0.5.7'
.. code-block:: bash

For global activation of all argcomplete enabled python applications run::
sudo pip install 'argcomplete>=0.5.7'

For global activation of all argcomplete enabled python applications run:

.. code-block:: bash

sudo activate-global-python-argcomplete

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

.. code-block:: bash

register-python-argcomplete pytest >> ~/.bashrc

register-python-argcomplete pytest >> ~/.bashrc
For one-time activation of argcomplete for ``pytest`` only, use:

For one-time activation of argcomplete for ``pytest`` only, use::
.. code-block:: bash

eval "$(register-python-argcomplete pytest)"
eval "$(register-python-argcomplete pytest)"
8 changes: 6 additions & 2 deletions doc/en/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ Behavior when no tests failed in the last run

When no tests failed in the last run, or when no cached ``lastfailed`` data was
found, ``pytest`` can be configured either to run all of the tests or no tests,
using the ``--last-failed-no-failures`` option, which takes one of the following values::
using the ``--last-failed-no-failures`` option, which takes one of the following values:

.. code-block:: bash

pytest --last-failed --last-failed-no-failures all # run all tests (default behavior)
pytest --last-failed --last-failed-no-failures none # run no tests and exit
Expand Down Expand Up @@ -283,7 +285,9 @@ Clearing Cache content
-------------------------------

You can instruct pytest to clear all cache files and values
by adding the ``--cache-clear`` option like this::
by adding the ``--cache-clear`` option like this:

.. code-block:: bash

pytest --cache-clear

Expand Down
4 changes: 3 additions & 1 deletion doc/en/capture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ There are two ways in which ``pytest`` can perform capturing:

.. _`disable capturing`:

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

.. code-block:: bash

pytest -s # disable all capturing
pytest --capture=sys # replace sys.stdout/stderr with in-mem files
Expand Down
28 changes: 21 additions & 7 deletions doc/en/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Command line options and configuration file settings
-----------------------------------------------------------------

You can get help on command line options and values in INI-style
configurations files by using the general help option::
configurations files by using the general help option:

.. code-block:: bash

pytest -h # prints options _and_ config file settings

Expand Down Expand Up @@ -92,12 +94,16 @@ The rootdir is used a reference directory for constructing test
addresses ("nodeids") and can be used also by plugins for storing
per-testrun information.

Example::
Example:

.. code-block:: bash

pytest path/to/testdir path/other/

will determine the common ancestor as ``path`` and then
check for ini-files as follows::
check for ini-files as follows:

.. code-block:: text

# first look for pytest.ini files
path/pytest.ini
Expand Down Expand Up @@ -133,19 +139,27 @@ progress output, you can write it into a configuration file:
addopts = -ra -q

Alternatively, you can set a ``PYTEST_ADDOPTS`` environment variable to add command
line options while the environment is in use::
line options while the environment is in use:

.. code-block:: bash

export PYTEST_ADDOPTS="-v"

Here's how the command-line is built in the presence of ``addopts`` or the environment variable::
Here's how the command-line is built in the presence of ``addopts`` or the environment variable:

.. code-block:: text

<pytest.ini:addopts> $PYTEST_ADDOPTS <extra command-line arguments>

So if the user executes in the command-line::
So if the user executes in the command-line:

.. code-block:: bash

pytest -m slow

The actual command line executed is::
The actual command line executed is:

.. code-block:: bash

pytest -ra -q -v -m slow

Expand Down
28 changes: 21 additions & 7 deletions doc/en/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Doctest integration for modules and test files

By default all files matching the ``test*.txt`` pattern will
be run through the python standard ``doctest`` module. You
can change the pattern by issuing::
can change the pattern by issuing:

.. code-block:: bash

pytest --doctest-glob='*.rst'

Expand All @@ -26,7 +28,9 @@ can be given multiple times in the command-line.

You can also trigger running of doctests
from docstrings in all python modules (including regular
python test modules)::
python test modules):

.. code-block:: bash

pytest --doctest-modules

Expand All @@ -39,7 +43,9 @@ putting them into a pytest.ini file like this:
[pytest]
addopts = --doctest-modules

If you then have a text file like this::
If you then have a text file like this:

.. code-block:: text

# content of example.rst

Expand Down Expand Up @@ -73,7 +79,9 @@ then you can just invoke ``pytest`` without command line options:

========================= 1 passed in 0.12 seconds =========================

It is possible to use fixtures using the ``getfixture`` helper::
It is possible to use fixtures using the ``getfixture`` helper:

.. code-block:: text

# content of example.rst
>>> tmp = getfixture('tmpdir')
Expand Down Expand Up @@ -112,14 +120,18 @@ the ``doctest_optionflags`` ini option:


Alternatively, it can be enabled by an inline comment in the doc test
itself::
itself:

.. code-block:: rst

# content of example.rst
>>> get_unicode_greeting() # doctest: +ALLOW_UNICODE
'Hello'

By default, pytest would report only the first failure for a given doctest. If
you want to continue the test even when you have failures, do::
you want to continue the test even when you have failures, do:

.. code-block:: bash

pytest --doctest-modules --doctest-continue-on-failure

Expand Down Expand Up @@ -167,7 +179,9 @@ Output format
You can change the diff output format on failure for your doctests
by using one of standard doctest modules format in options
(see :data:`python:doctest.REPORT_UDIFF`, :data:`python:doctest.REPORT_CDIFF`,
:data:`python:doctest.REPORT_NDIFF`, :data:`python:doctest.REPORT_ONLY_FIRST_FAILURE`)::
:data:`python:doctest.REPORT_NDIFF`, :data:`python:doctest.REPORT_ONLY_FIRST_FAILURE`):

.. code-block:: bash

pytest --doctest-modules --doctest-report none
pytest --doctest-modules --doctest-report udiff
Expand Down
12 changes: 9 additions & 3 deletions doc/en/example/markers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,18 @@ Registering markers

.. ini-syntax for custom markers:

Registering markers for your test suite is simple::
Registering markers for your test suite is simple:

.. code-block:: ini

# content of pytest.ini
[pytest]
markers =
webtest: mark a test as a webtest.

You can ask which markers exist for your test suite - the list includes our just defined ``webtest`` markers::
You can ask which markers exist for your test suite - the list includes our just defined ``webtest`` markers:

.. code-block:: pytest

$ pytest --markers
@pytest.mark.webtest: mark a test as a webtest.
Expand Down Expand Up @@ -388,7 +392,9 @@ and here is one that specifies exactly the environment needed:

========================= 1 passed in 0.12 seconds =========================

The ``--markers`` option always gives you a list of available markers::
The ``--markers`` option always gives you a list of available markers:

.. code-block:: pytest

$ pytest --markers
@pytest.mark.env(name): mark test to run only on named environment
Expand Down
Loading