Skip to content

Commit 4668ee0

Browse files
authored
Merge pull request #4887 from blueyed/merge-master-into-features
Merge master into features
2 parents 23ea04f + 7668703 commit 4668ee0

32 files changed

+303
-244
lines changed

.coveragerc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
[run]
2-
source = pytest,_pytest,testing/
2+
include =
3+
*/src/*
4+
testing/*
5+
*/lib/python*/site-packages/_pytest/*
6+
*/lib/python*/site-packages/pytest.py
7+
*/pypy*/site-packages/_pytest/*
8+
*/pypy*/site-packages/pytest.py
9+
*\Lib\site-packages\_pytest\*
10+
*\Lib\site-packages\pytest.py
311
parallel = 1
412
branch = 1
513

614
[paths]
715
source = src/
8-
.tox/*/lib/python*/site-packages/
9-
.tox\*\Lib\site-packages\
16+
*/lib/python*/site-packages/
17+
*/pypy*/site-packages/
18+
*\Lib\site-packages\

.travis.yml

Lines changed: 74 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,69 +9,86 @@ stages:
99
python:
1010
- '3.7'
1111
install:
12-
- pip install --upgrade --pre tox
13-
env:
14-
matrix:
15-
- TOXENV=py27
16-
# Specialized factors for py27.
17-
- TOXENV=py27-nobyte
18-
- TOXENV=py27-xdist
19-
- TOXENV=py27-pluggymaster
20-
# Specialized factors for py37.
21-
- TOXENV=py37-pexpect,py37-trial,py37-numpy
22-
- TOXENV=py37-pluggymaster
23-
- TOXENV=py37-freeze PYTEST_NO_COVERAGE=1
24-
25-
matrix:
26-
allow_failures:
27-
- python: '3.8-dev'
28-
env: TOXENV=py38-xdist
12+
- python -m pip install --upgrade --pre tox
2913

3014
jobs:
3115
include:
16+
# OSX tests - first (in test stage), since they are the slower ones.
17+
- &test-macos
18+
# NOTE: (tests with) pexpect appear to be buggy on Travis,
19+
# at least with coverage.
20+
# Log: https://travis-ci.org/pytest-dev/pytest/jobs/500358864
21+
os: osx
22+
osx_image: xcode10.1
23+
language: generic
24+
# Coverage for:
25+
# - py2 with symlink in test_cmdline_python_package_symlink.
26+
env: TOXENV=py27-xdist PYTEST_COVERAGE=1
27+
before_install:
28+
- python -V
29+
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27
30+
- <<: *test-macos
31+
env: TOXENV=py37-xdist
32+
before_install:
33+
- which python3
34+
- python3 -V
35+
- ln -sfn "$(which python3)" /usr/local/bin/python
36+
- python -V
37+
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37
38+
39+
# Full run of latest (major) supported versions, without xdist.
40+
- env: TOXENV=py27
41+
python: '2.7'
42+
- env: TOXENV=py37
43+
python: '3.7'
44+
3245
# Coverage tracking is slow with pypy, skip it.
33-
- env: TOXENV=pypy-xdist PYTEST_NO_COVERAGE=1
46+
- env: TOXENV=pypy-xdist
3447
python: 'pypy2.7-6.0'
35-
- env: TOXENV=pypy3-xdist PYTEST_NO_COVERAGE=1
48+
- env: TOXENV=pypy3-xdist
3649
python: 'pypy3.5-6.0'
3750

3851
- env: TOXENV=py34-xdist
3952
python: '3.4'
4053
- env: TOXENV=py35-xdist
4154
python: '3.5'
42-
- env: TOXENV=py36-xdist
43-
python: '3.6'
44-
- env: TOXENV=py37
45-
- &test-macos
46-
language: generic
47-
os: osx
48-
osx_image: xcode9.4
49-
sudo: required
50-
install:
51-
- python -m pip install --pre tox
52-
env: TOXENV=py27-xdist
53-
- <<: *test-macos
54-
env: TOXENV=py37-xdist
55-
before_install:
56-
- brew update
57-
- brew upgrade python
58-
- brew unlink python
59-
- brew link python
55+
56+
# Coverage for:
57+
# - pytester's LsofFdLeakChecker
58+
# - TestArgComplete (linux only)
59+
# - numpy
60+
- env: TOXENV=py37-lsof-numpy-xdist PYTEST_COVERAGE=1
61+
62+
# Specialized factors for py27.
63+
- env: TOXENV=py27-nobyte-numpy-xdist
64+
python: '2.7'
65+
- env: TOXENV=py27-pluggymaster-xdist
66+
python: '2.7'
67+
68+
# Specialized factors for py37.
69+
# Coverage for:
70+
# - test_sys_breakpoint_interception (via pexpect).
71+
- env: TOXENV=py37-pexpect,py37-trial PYTEST_COVERAGE=1
72+
- env: TOXENV=py37-pluggymaster-xdist
73+
- env: TOXENV=py37-freeze
6074

6175
# Jobs only run via Travis cron jobs (currently daily).
6276
- env: TOXENV=py38-xdist
6377
python: '3.8-dev'
6478
if: type = cron
6579

6680
- stage: baseline
67-
env: TOXENV=py27-pexpect,py27-trial,py27-numpy
68-
- env: TOXENV=py37-xdist
69-
- env: TOXENV=linting,docs,doctesting
70-
python: '3.7'
81+
# Coverage for:
82+
# - _pytest.unittest._handle_skip (via pexpect).
83+
env: TOXENV=py27-pexpect,py27-trial PYTEST_COVERAGE=1
84+
python: '2.7'
85+
# Use py36 here for faster baseline.
86+
- env: TOXENV=py36-xdist
87+
python: '3.6'
88+
- env: TOXENV=linting,docs,doctesting PYTEST_COVERAGE=1
7189

7290
- stage: deploy
7391
python: '3.6'
74-
env: PYTEST_NO_COVERAGE=1
7592
install: pip install -U setuptools setuptools_scm
7693
script: skip
7794
deploy:
@@ -85,9 +102,19 @@ jobs:
85102
tags: true
86103
repo: pytest-dev/pytest
87104

105+
matrix:
106+
allow_failures:
107+
- python: '3.8-dev'
108+
env: TOXENV=py38-xdist
109+
88110
before_script:
89111
- |
90-
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
112+
# Do not (re-)upload coverage with cron runs.
113+
if [[ "$TRAVIS_EVENT_TYPE" = cron ]]; then
114+
PYTEST_COVERAGE=0
115+
fi
116+
- |
117+
if [[ "$PYTEST_COVERAGE" = 1 ]]; then
91118
export COVERAGE_FILE="$PWD/.coverage"
92119
export COVERAGE_PROCESS_START="$PWD/.coveragerc"
93120
export _PYTEST_TOX_COVERAGE_RUN="coverage run -m"
@@ -98,14 +125,14 @@ script: tox --recreate
98125

99126
after_success:
100127
- |
101-
if [[ "$PYTEST_NO_COVERAGE" != 1 ]]; then
128+
if [[ "$PYTEST_COVERAGE" = 1 ]]; then
102129
set -e
103130
# Add last TOXENV to $PATH.
104131
PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH"
105132
coverage combine
106-
coverage xml --ignore-errors
107-
coverage report -m --ignore-errors
108-
bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -F $TRAVIS_OS_NAME
133+
coverage xml
134+
coverage report -m
135+
bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -n $TOXENV-$TRAVIS_OS_NAME
109136
fi
110137
111138
notifications:

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
.. image:: https://travis-ci.org/pytest-dev/pytest.svg?branch=master
2323
:target: https://travis-ci.org/pytest-dev/pytest
2424

25-
.. image:: https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true
26-
:target: https://ci.appveyor.com/project/pytestbot/pytest
25+
.. image:: https://dev.azure.com/pytest-dev/pytest/_apis/build/status/pytest-CI?branchName=master
26+
:target: https://dev.azure.com/pytest-dev/pytest
2727

2828
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
2929
:target: https://github.com/ambv/black

appveyor.yml

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

azure-pipelines.yml

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ variables:
66
PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml"
77
python.needs_vc: False
88
python.exe: "python"
9+
COVERAGE_FILE: "$(Build.Repository.LocalPath)/.coverage"
10+
COVERAGE_PROCESS_START: "$(Build.Repository.LocalPath)/.coveragerc"
11+
PYTEST_COVERAGE: '0'
912

1013
jobs:
1114

@@ -17,47 +20,68 @@ jobs:
1720
py27:
1821
python.version: '2.7'
1922
tox.env: 'py27'
20-
py27-xdist:
23+
py27-nobyte-lsof-numpy:
2124
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'
25+
tox.env: 'py27-lsof-nobyte-numpy'
26+
# Coverage for:
27+
# - test_supports_breakpoint_module_global
28+
# - test_terminal_reporter_writer_attr (without xdist)
29+
# - "if write" branch in _pytest.assertion.rewrite
30+
# - numpy
31+
# - pytester's LsofFdLeakChecker (being skipped)
32+
PYTEST_COVERAGE: '1'
2633
py27-trial:
2734
python.version: '2.7'
2835
tox.env: 'py27-trial'
2936
python.needs_vc: True
30-
py27-pluggymaster:
37+
py27-pluggymaster-xdist:
3138
python.version: '2.7'
32-
tox.env: 'pluggymaster'
39+
tox.env: 'py27-pluggymaster-xdist'
40+
# Coverage for:
41+
# - except-IOError in _attempt_to_close_capture_file for py2.
42+
# Also seen with py27-nobyte (using xdist), and py27-xdist.
43+
# But no exception with py27-pexpect,py27-trial,py27-numpy.
44+
PYTEST_COVERAGE: '1'
3345
pypy:
3446
python.version: 'pypy'
3547
tox.env: 'pypy'
3648
python.exe: 'pypy'
37-
py34:
49+
# NOTE: pypy3 fails to install pip currently due to an interal error.
50+
# pypy3:
51+
# python.version: 'pypy3'
52+
# tox.env: 'pypy3'
53+
# python.exe: 'pypy3'
54+
py34-xdist:
3855
python.version: '3.4'
39-
tox.env: 'py34'
40-
py35:
56+
tox.env: 'py34-xdist'
57+
# Coverage for:
58+
# - _pytest.compat._bytes_to_ascii
59+
PYTEST_COVERAGE: '1'
60+
py35-xdist:
4161
python.version: '3.5'
42-
tox.env: 'py35'
43-
py36:
62+
tox.env: 'py35-xdist'
63+
# Coverage for:
64+
# - test_supports_breakpoint_module_global
65+
PYTEST_COVERAGE: '1'
66+
py36-xdist:
4467
python.version: '3.6'
45-
tox.env: 'py36'
68+
tox.env: 'py36-xdist'
4669
py37:
4770
python.version: '3.7'
4871
tox.env: 'py37'
72+
# Coverage for:
73+
# - _py36_windowsconsoleio_workaround (with py36+)
74+
# - test_request_garbage (no xdist)
75+
PYTEST_COVERAGE: '1'
4976
py37-linting/docs/doctesting:
5077
python.version: '3.7'
5178
tox.env: 'linting,docs,doctesting'
52-
py37-xdist:
53-
python.version: '3.7'
54-
tox.env: 'py37-xdist'
5579
py37-trial/numpy:
5680
python.version: '3.7'
5781
tox.env: 'py37-trial,py37-numpy'
58-
py37-pluggymaster:
82+
py37-pluggymaster-xdist:
5983
python.version: '3.7'
60-
tox.env: 'py37-pluggymaster'
84+
tox.env: 'py37-pluggymaster-xdist'
6185
maxParallel: 10
6286

6387
steps:
@@ -91,11 +115,21 @@ jobs:
91115
- script: $(python.exe) -m pip install --upgrade pip && $(python.exe) -m pip install tox
92116
displayName: 'Install tox'
93117

94-
- script: $(python.exe) -m tox -e $(tox.env)
118+
- script: |
119+
call scripts/setup-coverage-vars.bat || goto :eof
120+
$(python.exe) -m tox -e $(tox.env)
95121
displayName: 'Run tests'
96122
97123
- task: PublishTestResults@2
98124
inputs:
99125
testResultsFiles: 'build/test-results/$(tox.env).xml'
100126
testRunTitle: '$(tox.env)'
101127
condition: succeededOrFailed()
128+
129+
- script: call scripts\upload-coverage.bat
130+
displayName: 'Report and upload coverage'
131+
condition: eq(variables['PYTEST_COVERAGE'], '1')
132+
env:
133+
PYTHON: $(python.exe)
134+
CODECOV_TOKEN: $(CODECOV_TOKEN)
135+
PYTEST_CODECOV_NAME: $(tox.env)

bench/skip.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import pytest
44

5-
65
SKIP = True
76

87

changelog/4861.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve validation of contents written to captured output so it behaves the same as when capture is disabled.

0 commit comments

Comments
 (0)