Merge pull request #4787 from blueyed/travis-xdist

Travis: use xdist for py?? envs, keeping py27/py37
This commit is contained in:
Daniel Hahler 2019-02-15 18:35:21 +01:00 committed by GitHub
commit 498b994eb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 33 deletions

View File

@ -27,7 +27,7 @@ env:
matrix: matrix:
allow_failures: allow_failures:
- python: '3.8-dev' - python: '3.8-dev'
env: TOXENV=py38 env: TOXENV=py38-xdist
jobs: jobs:
include: include:
@ -35,11 +35,11 @@ jobs:
- env: TOXENV=pypy PYTEST_NO_COVERAGE=1 - env: TOXENV=pypy PYTEST_NO_COVERAGE=1
python: 'pypy-5.4' python: 'pypy-5.4'
dist: trusty dist: trusty
- env: TOXENV=py34 - env: TOXENV=py34-xdist
python: '3.4' python: '3.4'
- env: TOXENV=py35 - env: TOXENV=py35-xdist
python: '3.5' python: '3.5'
- env: TOXENV=py36 - env: TOXENV=py36-xdist
python: '3.6' python: '3.6'
- env: TOXENV=py37 - env: TOXENV=py37
- &test-macos - &test-macos
@ -49,9 +49,9 @@ jobs:
sudo: required sudo: required
install: install:
- python -m pip install --pre tox - python -m pip install --pre tox
env: TOXENV=py27 env: TOXENV=py27-xdist
- <<: *test-macos - <<: *test-macos
env: TOXENV=py37 env: TOXENV=py37-xdist
before_install: before_install:
- brew update - brew update
- brew upgrade python - brew upgrade python
@ -65,7 +65,7 @@ jobs:
python: '3.7' python: '3.7'
- stage: cron_only - stage: cron_only
env: TOXENV=py38 env: TOXENV=py38-xdist
python: '3.8-dev' python: '3.8-dev'
- stage: deploy - stage: deploy

View File

@ -2,12 +2,10 @@ environment:
matrix: matrix:
- TOXENV: "py37-xdist" - TOXENV: "py37-xdist"
- TOXENV: "py27-xdist" - TOXENV: "py27-xdist"
- TOXENV: "py27"
- TOXENV: "py37"
- TOXENV: "linting,docs,doctesting" - TOXENV: "linting,docs,doctesting"
- TOXENV: "py36" - TOXENV: "py34-xdist"
- TOXENV: "py35" - TOXENV: "py35-xdist"
- TOXENV: "py34" - TOXENV: "py36-xdist"
- TOXENV: "pypy" - TOXENV: "pypy"
PYTEST_NO_COVERAGE: "1" PYTEST_NO_COVERAGE: "1"
# Specialized factors for py27. # Specialized factors for py27.

View File

@ -280,7 +280,9 @@ class TerminalReporter(object):
def write_fspath_result(self, nodeid, res, **markup): def write_fspath_result(self, nodeid, res, **markup):
fspath = self.config.rootdir.join(nodeid.split("::")[0]) fspath = self.config.rootdir.join(nodeid.split("::")[0])
if fspath != self.currentfspath: # NOTE: explicitly check for None to work around py bug, and for less
# overhead in general (https://github.com/pytest-dev/py/pull/207).
if self.currentfspath is None or fspath != self.currentfspath:
if self.currentfspath is not None and self._show_progress_info: if self.currentfspath is not None and self._show_progress_info:
self._write_progress_information_filling_space() self._write_progress_information_filling_space()
self.currentfspath = fspath self.currentfspath = fspath

View File

@ -1308,10 +1308,17 @@ class TestEarlyRewriteBailout(object):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform.startswith("win32"), reason="cannot remove cwd on Windows" sys.platform.startswith("win32"), reason="cannot remove cwd on Windows"
) )
def test_cwd_changed(self, testdir): def test_cwd_changed(self, testdir, monkeypatch):
# Setup conditions for py's fspath trying to import pathlib on py34
# always (previously triggered via xdist only).
# Ref: https://github.com/pytest-dev/py/pull/207
monkeypatch.setattr(sys, "path", [""] + sys.path)
if "pathlib" in sys.modules:
del sys.modules["pathlib"]
testdir.makepyfile( testdir.makepyfile(
**{ **{
"test_bar.py": """ "test_setup_nonexisting_cwd.py": """
import os import os
import shutil import shutil
import tempfile import tempfile
@ -1320,7 +1327,7 @@ class TestEarlyRewriteBailout(object):
os.chdir(d) os.chdir(d)
shutil.rmtree(d) shutil.rmtree(d)
""", """,
"test_foo.py": """ "test_test.py": """
def test(): def test():
pass pass
""", """,

21
tox.ini
View File

@ -20,19 +20,22 @@ envlist =
[testenv] [testenv]
commands = commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest --lsof {posargs} {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {env:_PYTEST_TOX_ARGS:} {posargs}
coverage: coverage combine coverage: coverage combine
coverage: coverage report coverage: coverage report
passenv = USER USERNAME COVERAGE_* TRAVIS PYTEST_ADDOPTS passenv = USER USERNAME COVERAGE_* TRAVIS PYTEST_ADDOPTS
setenv = setenv =
_PYTEST_TOX_ARGS=--lsof
# Configuration to run with coverage similar to Travis/Appveyor, e.g. # Configuration to run with coverage similar to Travis/Appveyor, e.g.
# "tox -e py37-coverage". # "tox -e py37-coverage".
coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m
coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
coverage: COVERAGE_FILE={toxinidir}/.coverage coverage: COVERAGE_FILE={toxinidir}/.coverage
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
xdist: _PYTEST_TOX_ARGS={env:_PYTEST_TOX_ARGS:-n auto}
extras = testing extras = testing
deps = deps =
xdist: pytest-xdist>=1.13
{env:_PYTEST_TOX_EXTRA_DEP:} {env:_PYTEST_TOX_EXTRA_DEP:}
[testenv:py27-subprocess] [testenv:py27-subprocess]
@ -50,22 +53,6 @@ basepython = python3
deps = pre-commit>=1.11.0 deps = pre-commit>=1.11.0
commands = pre-commit run --all-files --show-diff-on-failure commands = pre-commit run --all-files --show-diff-on-failure
[testenv:py27-xdist]
extras = testing
deps =
{[testenv]deps}
pytest-xdist>=1.13
commands =
{env:_PYTEST_TOX_COVERAGE_RUN:} pytest -n auto {posargs}
[testenv:py37-xdist]
# NOTE: copied from above due to https://github.com/tox-dev/tox/issues/706.
extras = testing
deps =
{[testenv]deps}
pytest-xdist>=1.13
commands = {[testenv:py27-xdist]commands}
[testenv:py27-pexpect] [testenv:py27-pexpect]
platform = linux|darwin platform = linux|darwin
deps = deps =