Skip to content

Commit 63e7f8e

Browse files
authored
Merge pull request #4817 from nicoddemus/merge-master-into-features
Merge master into features (including fix from 4816)
2 parents b9561e2 + 0ca1f6e commit 63e7f8e

28 files changed

+333
-98
lines changed

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ matrix:
3030
jobs:
3131
include:
3232
# Coverage tracking is slow with pypy, skip it.
33-
- env: TOXENV=pypy PYTEST_NO_COVERAGE=1
34-
python: 'pypy-5.4'
35-
dist: trusty
33+
- env: TOXENV=pypy-xdist PYTEST_NO_COVERAGE=1
34+
python: 'pypy2.7-6.0'
35+
- env: TOXENV=pypy3-xdist PYTEST_NO_COVERAGE=1
36+
python: 'pypy3.5-6.0'
37+
3638
- env: TOXENV=py34-xdist
3739
python: '3.4'
3840
- env: TOXENV=py35-xdist

azure-pipelines.yml

+59-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ trigger:
44

55
variables:
66
PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml"
7+
python.needs_vc: False
8+
python.exe: "python"
79

810
jobs:
911

@@ -15,6 +17,26 @@ jobs:
1517
py27:
1618
python.version: '2.7'
1719
tox.env: 'py27'
20+
py27-xdist:
21+
python.version: '2.7'
22+
tox.env: 'py27-xdist'
23+
py27-numpy/nobyte:
24+
python.version: '2.7'
25+
tox.env: 'py27-numpy,py27-nobyte'
26+
py27-trial:
27+
python.version: '2.7'
28+
tox.env: 'py27-trial'
29+
python.needs_vc: True
30+
py27-pluggymaster:
31+
python.version: '2.7'
32+
tox.env: 'pluggymaster'
33+
pypy:
34+
python.version: 'pypy'
35+
tox.env: 'pypy'
36+
python.exe: 'pypy'
37+
py34:
38+
python.version: '3.4'
39+
tox.env: 'py34'
1840
py35:
1941
python.version: '3.5'
2042
tox.env: 'py35'
@@ -24,18 +46,52 @@ jobs:
2446
py37:
2547
python.version: '3.7'
2648
tox.env: 'py37'
27-
maxParallel: 4
49+
py37-linting/docs/doctesting:
50+
python.version: '3.7'
51+
tox.env: 'linting,docs,doctesting'
52+
py37-xdist:
53+
python.version: '3.7'
54+
tox.env: 'py37-xdist'
55+
py37-trial/numpy:
56+
python.version: '3.7'
57+
tox.env: 'py37-trial,py37-numpy'
58+
py37-pluggymaster:
59+
python.version: '3.7'
60+
tox.env: 'py37-pluggymaster'
61+
maxParallel: 10
2862

2963
steps:
3064
- task: UsePythonVersion@0
65+
condition: not(startsWith(variables['python.exe'], 'pypy'))
3166
inputs:
3267
versionSpec: '$(python.version)'
3368
architecture: 'x64'
3469

35-
- script: python -m pip install --upgrade pip && pip install tox
70+
- script: choco install vcpython27
71+
condition: eq(variables['python.needs_vc'], True)
72+
displayName: 'Install VC for py27'
73+
74+
- script: choco install python.pypy
75+
condition: eq(variables['python.exe'], 'pypy')
76+
displayName: 'Install pypy'
77+
78+
- script: choco install pypy3
79+
condition: eq(variables['python.exe'], 'pypy3')
80+
displayName: 'Install pypy3'
81+
82+
- task: PowerShell@2
83+
inputs:
84+
targetType: 'inline'
85+
script: |
86+
Invoke-WebRequest -Uri "https://bootstrap.pypa.io/get-pip.py" -OutFile "get-pip.py"
87+
$(python.exe) get-pip.py
88+
condition: startsWith(variables['python.exe'], 'pypy')
89+
displayName: 'Install pip'
90+
91+
- script: $(python.exe) -m pip install --upgrade pip && $(python.exe) -m pip install tox
3692
displayName: 'Install tox'
3793

38-
- script: python -m tox -e $(tox.env)
94+
- script: $(python.exe) -m tox -e $(tox.env)
3995
displayName: 'Run tests'
4096

4197
- task: PublishTestResults@2

changelog/4810.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Logging messages inside ``pytest_runtest_logreport()`` are now properly captured and displayed.

doc/en/bash-completion.rst

+15-7
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,26 @@ When using bash as your shell, ``pytest`` can use argcomplete
88
(https://argcomplete.readthedocs.io/) for auto-completion.
99
For this ``argcomplete`` needs to be installed **and** enabled.
1010

11-
Install argcomplete using::
11+
Install argcomplete using:
1212

13-
sudo pip install 'argcomplete>=0.5.7'
13+
.. code-block:: bash
1414
15-
For global activation of all argcomplete enabled python applications run::
15+
sudo pip install 'argcomplete>=0.5.7'
16+
17+
For global activation of all argcomplete enabled python applications run:
18+
19+
.. code-block:: bash
1620
1721
sudo activate-global-python-argcomplete
1822
19-
For permanent (but not global) ``pytest`` activation, use::
23+
For permanent (but not global) ``pytest`` activation, use:
24+
25+
.. code-block:: bash
26+
27+
register-python-argcomplete pytest >> ~/.bashrc
2028
21-
register-python-argcomplete pytest >> ~/.bashrc
29+
For one-time activation of argcomplete for ``pytest`` only, use:
2230

23-
For one-time activation of argcomplete for ``pytest`` only, use::
31+
.. code-block:: bash
2432
25-
eval "$(register-python-argcomplete pytest)"
33+
eval "$(register-python-argcomplete pytest)"

doc/en/cache.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ Behavior when no tests failed in the last run
168168

169169
When no tests failed in the last run, or when no cached ``lastfailed`` data was
170170
found, ``pytest`` can be configured either to run all of the tests or no tests,
171-
using the ``--last-failed-no-failures`` option, which takes one of the following values::
171+
using the ``--last-failed-no-failures`` option, which takes one of the following values:
172+
173+
.. code-block:: bash
172174
173175
pytest --last-failed --last-failed-no-failures all # run all tests (default behavior)
174176
pytest --last-failed --last-failed-no-failures none # run no tests and exit
@@ -283,7 +285,9 @@ Clearing Cache content
283285
-------------------------------
284286

285287
You can instruct pytest to clear all cache files and values
286-
by adding the ``--cache-clear`` option like this::
288+
by adding the ``--cache-clear`` option like this:
289+
290+
.. code-block:: bash
287291
288292
pytest --cache-clear
289293

doc/en/capture.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ There are two ways in which ``pytest`` can perform capturing:
3535

3636
.. _`disable capturing`:
3737

38-
You can influence output capturing mechanisms from the command line::
38+
You can influence output capturing mechanisms from the command line:
39+
40+
.. code-block:: bash
3941
4042
pytest -s # disable all capturing
4143
pytest --capture=sys # replace sys.stdout/stderr with in-mem files

doc/en/customize.rst

+21-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ Command line options and configuration file settings
55
-----------------------------------------------------------------
66

77
You can get help on command line options and values in INI-style
8-
configurations files by using the general help option::
8+
configurations files by using the general help option:
9+
10+
.. code-block:: bash
911
1012
pytest -h # prints options _and_ config file settings
1113
@@ -92,12 +94,16 @@ The rootdir is used a reference directory for constructing test
9294
addresses ("nodeids") and can be used also by plugins for storing
9395
per-testrun information.
9496

95-
Example::
97+
Example:
98+
99+
.. code-block:: bash
96100
97101
pytest path/to/testdir path/other/
98102
99103
will determine the common ancestor as ``path`` and then
100-
check for ini-files as follows::
104+
check for ini-files as follows:
105+
106+
.. code-block:: text
101107
102108
# first look for pytest.ini files
103109
path/pytest.ini
@@ -133,19 +139,27 @@ progress output, you can write it into a configuration file:
133139
addopts = -ra -q
134140
135141
Alternatively, you can set a ``PYTEST_ADDOPTS`` environment variable to add command
136-
line options while the environment is in use::
142+
line options while the environment is in use:
143+
144+
.. code-block:: bash
137145
138146
export PYTEST_ADDOPTS="-v"
139147
140-
Here's how the command-line is built in the presence of ``addopts`` or the environment variable::
148+
Here's how the command-line is built in the presence of ``addopts`` or the environment variable:
149+
150+
.. code-block:: text
141151
142152
<pytest.ini:addopts> $PYTEST_ADDOPTS <extra command-line arguments>
143153
144-
So if the user executes in the command-line::
154+
So if the user executes in the command-line:
155+
156+
.. code-block:: bash
145157
146158
pytest -m slow
147159
148-
The actual command line executed is::
160+
The actual command line executed is:
161+
162+
.. code-block:: bash
149163
150164
pytest -ra -q -v -m slow
151165

doc/en/doctest.rst

+21-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Doctest integration for modules and test files
44

55
By default all files matching the ``test*.txt`` pattern will
66
be run through the python standard ``doctest`` module. You
7-
can change the pattern by issuing::
7+
can change the pattern by issuing:
8+
9+
.. code-block:: bash
810
911
pytest --doctest-glob='*.rst'
1012
@@ -26,7 +28,9 @@ can be given multiple times in the command-line.
2628

2729
You can also trigger running of doctests
2830
from docstrings in all python modules (including regular
29-
python test modules)::
31+
python test modules):
32+
33+
.. code-block:: bash
3034
3135
pytest --doctest-modules
3236
@@ -39,7 +43,9 @@ putting them into a pytest.ini file like this:
3943
[pytest]
4044
addopts = --doctest-modules
4145
42-
If you then have a text file like this::
46+
If you then have a text file like this:
47+
48+
.. code-block:: text
4349
4450
# content of example.rst
4551
@@ -73,7 +79,9 @@ then you can just invoke ``pytest`` without command line options:
7379
7480
========================= 1 passed in 0.12 seconds =========================
7581
76-
It is possible to use fixtures using the ``getfixture`` helper::
82+
It is possible to use fixtures using the ``getfixture`` helper:
83+
84+
.. code-block:: text
7785
7886
# content of example.rst
7987
>>> tmp = getfixture('tmpdir')
@@ -112,14 +120,18 @@ the ``doctest_optionflags`` ini option:
112120
113121
114122
Alternatively, it can be enabled by an inline comment in the doc test
115-
itself::
123+
itself:
124+
125+
.. code-block:: rst
116126
117127
# content of example.rst
118128
>>> get_unicode_greeting() # doctest: +ALLOW_UNICODE
119129
'Hello'
120130
121131
By default, pytest would report only the first failure for a given doctest. If
122-
you want to continue the test even when you have failures, do::
132+
you want to continue the test even when you have failures, do:
133+
134+
.. code-block:: bash
123135
124136
pytest --doctest-modules --doctest-continue-on-failure
125137
@@ -167,7 +179,9 @@ Output format
167179
You can change the diff output format on failure for your doctests
168180
by using one of standard doctest modules format in options
169181
(see :data:`python:doctest.REPORT_UDIFF`, :data:`python:doctest.REPORT_CDIFF`,
170-
:data:`python:doctest.REPORT_NDIFF`, :data:`python:doctest.REPORT_ONLY_FIRST_FAILURE`)::
182+
:data:`python:doctest.REPORT_NDIFF`, :data:`python:doctest.REPORT_ONLY_FIRST_FAILURE`):
183+
184+
.. code-block:: bash
171185
172186
pytest --doctest-modules --doctest-report none
173187
pytest --doctest-modules --doctest-report udiff

doc/en/example/markers.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,18 @@ Registering markers
204204

205205
.. ini-syntax for custom markers:
206206
207-
Registering markers for your test suite is simple::
207+
Registering markers for your test suite is simple:
208+
209+
.. code-block:: ini
208210
209211
# content of pytest.ini
210212
[pytest]
211213
markers =
212214
webtest: mark a test as a webtest.
213215
214-
You can ask which markers exist for your test suite - the list includes our just defined ``webtest`` markers::
216+
You can ask which markers exist for your test suite - the list includes our just defined ``webtest`` markers:
217+
218+
.. code-block:: pytest
215219
216220
$ pytest --markers
217221
@pytest.mark.webtest: mark a test as a webtest.
@@ -388,7 +392,9 @@ and here is one that specifies exactly the environment needed:
388392
389393
========================= 1 passed in 0.12 seconds =========================
390394
391-
The ``--markers`` option always gives you a list of available markers::
395+
The ``--markers`` option always gives you a list of available markers:
396+
397+
.. code-block:: pytest
392398
393399
$ pytest --markers
394400
@pytest.mark.env(name): mark test to run only on named environment

0 commit comments

Comments
 (0)