Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis: use xdist for py?? envs, keeping py27/py37 #4787

Merged
merged 4 commits into from Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions .travis.yml
Expand Up @@ -27,19 +27,19 @@ env:
matrix:
allow_failures:
- python: '3.8-dev'
env: TOXENV=py38
env: TOXENV=py38-xdist

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=py34
- env: TOXENV=py34-xdist
python: '3.4'
- env: TOXENV=py35
- env: TOXENV=py35-xdist
python: '3.5'
- env: TOXENV=py36
- env: TOXENV=py36-xdist
python: '3.6'
- env: TOXENV=py37
- &test-macos
Expand All @@ -49,9 +49,9 @@ jobs:
sudo: required
install:
- python -m pip install --pre tox
env: TOXENV=py27
env: TOXENV=py27-xdist
- <<: *test-macos
env: TOXENV=py37
env: TOXENV=py37-xdist
before_install:
- brew update
- brew upgrade python
Expand All @@ -65,7 +65,7 @@ jobs:
python: '3.7'

- stage: cron_only
env: TOXENV=py38
env: TOXENV=py38-xdist
python: '3.8-dev'

- stage: deploy
Expand Down
8 changes: 3 additions & 5 deletions appveyor.yml
Expand Up @@ -2,12 +2,10 @@ environment:
matrix:
- TOXENV: "py37-xdist"
- TOXENV: "py27-xdist"
- TOXENV: "py27"
- TOXENV: "py37"
- TOXENV: "linting,docs,doctesting"
- TOXENV: "py36"
- TOXENV: "py35"
- TOXENV: "py34"
- TOXENV: "py34-xdist"
- TOXENV: "py35-xdist"
- TOXENV: "py36-xdist"
- TOXENV: "pypy"
PYTEST_NO_COVERAGE: "1"
# Specialized factors for py27.
Expand Down
4 changes: 3 additions & 1 deletion src/_pytest/terminal.py
Expand Up @@ -280,7 +280,9 @@ def hasopt(self, char):

def write_fspath_result(self, nodeid, res, **markup):
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:
self._write_progress_information_filling_space()
self.currentfspath = fspath
Expand Down
13 changes: 10 additions & 3 deletions testing/test_assertrewrite.py
Expand Up @@ -1308,10 +1308,17 @@ def test_simple_failure():
@pytest.mark.skipif(
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(
**{
"test_bar.py": """
"test_setup_nonexisting_cwd.py": """
import os
import shutil
import tempfile
Expand All @@ -1320,7 +1327,7 @@ def test_cwd_changed(self, testdir):
os.chdir(d)
shutil.rmtree(d)
""",
"test_foo.py": """
"test_test.py": """
def test():
pass
""",
Expand Down
21 changes: 4 additions & 17 deletions tox.ini
Expand Up @@ -20,19 +20,22 @@ envlist =

[testenv]
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 report
passenv = USER USERNAME COVERAGE_* TRAVIS PYTEST_ADDOPTS
setenv =
_PYTEST_TOX_ARGS=--lsof
# Configuration to run with coverage similar to Travis/Appveyor, e.g.
# "tox -e py37-coverage".
coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m
coverage: _PYTEST_TOX_EXTRA_DEP=coverage-enable-subprocess
coverage: COVERAGE_FILE={toxinidir}/.coverage
coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc
xdist: _PYTEST_TOX_ARGS={env:_PYTEST_TOX_ARGS:-n auto}
extras = testing
deps =
xdist: pytest-xdist>=1.13
{env:_PYTEST_TOX_EXTRA_DEP:}

[testenv:py27-subprocess]
Expand All @@ -50,22 +53,6 @@ basepython = python3
deps = pre-commit>=1.11.0
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]
platform = linux|darwin
deps =
Expand Down