Skip to content

Commit

Permalink
fix the failing CI on master (#1456)
Browse files Browse the repository at this point in the history
* fix

Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>

* suppress proc related failures on pypy

Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Nov 13, 2019
1 parent 6feee0b commit c85365e
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 44 deletions.
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
repos:
- repo: https://github.com/psf/black
rev: 19.3b0
rev: 19.10b0
hooks:
- id: black
args: [--safe]
language_version: python3.7
language_version: python3.8
- repo: https://github.com/asottile/blacken-docs
rev: v1.1.0
rev: v1.3.0
hooks:
- id: blacken-docs
additional_dependencies: [black==19.3b0]
language_version: python3.7
language_version: python3.8
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.1
rev: v1.9.3
hooks:
- id: seed-isort-config
args: [--application-directories, "src:."]
Expand All @@ -21,20 +21,20 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: flake8
additional_dependencies: ["flake8-bugbear == 19.3.0"]
language_version: python3.7
additional_dependencies: ["flake8-bugbear == 19.8.0"]
language_version: python3.8
- repo: https://github.com/asottile/pyupgrade
rev: v1.19.0
rev: v1.25.1
hooks:
- id: pyupgrade
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.4.0
rev: v1.4.2
hooks:
- id: rst-backticks
21 changes: 13 additions & 8 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,40 @@ pr:
variables:
PYTEST_ADDOPTS: "-v -v -ra --showlocals"
PYTEST_XDIST_PROC_NR: '0'
PRE_COMMIT_HOME: $(Pipeline.Workspace)/pre-commit-cache

jobs:
- template: run-tox-env.yml@tox
parameters:
tox_version: ''
jobs:
fix_lint: null
fix_lint:
before:
- task: CacheBeta@0
displayName: cache pre-commit
inputs:
key: pre-commit | .pre-commit-config.yaml
path: $(PRE_COMMIT_HOME)
docs: null
py38:
image: [linux]
py37:
image: [linux, windows, macOs]
py27:
image: [linux, windows, macOs]
pypy:
image: [linux]
pypy3:
image: [linux]
py37:
image: [linux, windows, macOs]
py36:
image: [linux, windows, macOs]
py35:
image: [linux, windows, macOs]
py34:
image: [linux, windows, macOs]
pypy3:
image: [linux]
dev: null
package_description: null
coverage:
with_toxenv: 'coverage' # generate .tox/.coverage, .tox/coverage.xml after test run
for_envs: [py37, py36, py35, py34, py27]
for_envs: [py38, py37, py36, py35, py27, pypy3, pypy]

- ${{ if startsWith(variables['Build.SourceBranch'], 'refs/tags/') }}:
- template: publish-pypi.yml@tox
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog/1452.bugfix.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix provisioning from a pyvenv interpreter. — by :user:`kentzo`
Fix provisioning from a pyvenv interpreter. — by :user:`kentzo`
1 change: 1 addition & 0 deletions docs/changelog/1456.deprecation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Python ``3.4`` is no longer supported. — by :user:`gaborbernat`
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ classifiers =

[options]
packages = find:
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
install_requires =
importlib-metadata >= 0.12, <1;python_version<"3.8"
packaging >= 14
Expand All @@ -63,7 +63,7 @@ testing =
pytest-cov >= 2.5.1, <3
pytest-mock >= 1.10.0, <2
pytest-xdist >= 1.22.2, <2
pytest-randomly >= 1.2.3, <2
pytest-randomly >= 1.0.0, <4
psutil >= 5.6.1, < 6; python_version != "3.4"
flaky >= 3.4.0, < 4
docs =
Expand Down
2 changes: 1 addition & 1 deletion src/tox/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def exit_code_str(exception_name, command, exit_code):
"""
str_ = "{} for command {}".format(exception_name, command)
if exit_code is not None:
if (exit_code < 0 or (os.name == "posix" and exit_code > 128)):
if exit_code < 0 or (os.name == "posix" and exit_code > 128):
signals = {
number: name for name, number in vars(signal).items() if name.startswith("SIG")
}
Expand Down
2 changes: 1 addition & 1 deletion src/tox/session/commands/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def provision_tox(provision_venv, args):
try:
env = os.environ.copy()
env[str("TOX_PROVISION")] = str("1")
env.pop('__PYVENV_LAUNCHER__', None)
env.pop("__PYVENV_LAUNCHER__", None)
action.popen(provision_args, redirect=False, report_fail=False, env=env)
return 0
except InvocationError as exception:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/test_parallel_interrupt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
from flaky import flaky
from pathlib2 import Path

from tox.constants import INFO
from tox.util.main import MAIN_FILE


@flaky(max_runs=3)
@pytest.mark.skipif(INFO.IS_PYPY, reason="TODO: process numbers work differently on pypy")
@pytest.mark.skipif(
"sys.platform == 'win32'", reason="triggering SIGINT reliably on Windows is hard"
)
Expand Down
6 changes: 5 additions & 1 deletion tests/integration/test_provision_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pytest
from pathlib2 import Path

from tox.constants import INFO
from tox.util.main import MAIN_FILE


Expand Down Expand Up @@ -41,6 +42,7 @@ def test_provision_missing(initproj, cmd):
assert meta_python.exists()


@pytest.mark.skipif("sys.platform == 'win32'", reason="pyenv does not exists on Windows")
def test_provision_from_pyvenv(initproj, cmd, monkeypatch):
initproj(
"pkg123-0.7",
Expand All @@ -59,8 +61,10 @@ def test_provision_from_pyvenv(initproj, cmd, monkeypatch):
monkeypatch.setenv(str("__PYVENV_LAUNCHER__"), sys.executable)
result = cmd("-e", "py", "-vv")
result.assert_fail()
assert '.tox/.tox/bin/python -m virtualenv' in result.out
assert ".tox/.tox/bin/python -m virtualenv" in result.out


@pytest.mark.skipif(INFO.IS_PYPY, reason="TODO: process numbers work differently on pypy")
@pytest.mark.skipif(
"sys.platform == 'win32'", reason="triggering SIGINT reliably on Windows is hard"
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ def test_getbool(self, newconfig):
reader.getbool("key3")
with pytest.raises(tox.exception.ConfigError) as excinfo:
reader.getbool("key5")
msg, = excinfo.value.args
(msg,) = excinfo.value.args
assert msg == "key5: boolean value 'yes' needs to be 'True' or 'False'"


Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def test_create_KeyboardInterrupt(mocksession, newconfig, mocker):
)
mocksession.new_config(config)
venv = mocksession.getvenv("py123")
with mocker.patch.object(venv, "_pcall", side_effect=KeyboardInterrupt):
with pytest.raises(KeyboardInterrupt):
venv.setupenv()
mocker.patch.object(venv, "_pcall", side_effect=KeyboardInterrupt)
with pytest.raises(KeyboardInterrupt):
venv.setupenv()

assert venv.status == "keyboardinterrupt"

Expand Down
34 changes: 18 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ skip_missing_interpreters = true

[testenv]
description = run the tests with pytest under {basepython}
setenv = PIP_DISABLE_VERSION_CHECK = 1
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
VIRTUALENV_NO_DOWNLOAD = 1
setenv =
PIP_DISABLE_PIP_VERSION_CHECK = 1
COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
passenv =
CURL_CA_BUNDLE
http_proxy
Expand All @@ -27,7 +27,8 @@ passenv =
REQUESTS_CA_BUNDLE
SSL_CERT_FILE
PYTEST_*
deps = pip == 19.1.1
PIP_CACHE_DIR
deps = pip >= 19.3.1
extras = testing
commands = pytest \
--cov "{envsitepackagesdir}/tox" \
Expand All @@ -38,14 +39,14 @@ commands = pytest \

[testenv:docs]
description = invoke sphinx-build to build the HTML docs
basepython = python3.7
basepython = python3.8
extras = docs
commands = sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" --color -W -bhtml {posargs}
python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))'

[testenv:package_description]
description = check that the long description is valid
basepython = python3.7
basepython = python3.8
deps = twine >= 1.12.1
# TODO installing readme-renderer[md] should not be necessary
readme-renderer[md] >= 24.0
Expand All @@ -57,15 +58,16 @@ commands = pip wheel -w {envtmpdir}/build --no-deps .

[testenv:fix_lint]
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
basepython = python3.7
passenv = {[testenv]passenv}
# without PROGRAMDATA cloning using git for Windows will fail with an
# `error setting certificate verify locations` error
PROGRAMDATA
basepython = python3.8
passenv =
{[testenv]passenv}
# without PROGRAMDATA cloning using git for Windows will fail with an `error setting certificate verify locations` error
PROGRAMDATA
PRE_COMMIT_HOME
extras = lint
deps = pre-commit >= 1.14.4, < 2
skip_install = True
commands = pre-commit run --all-files --show-diff-on-failure
commands = pre-commit run --all-files --show-diff-on-failure {posargs}
python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'


Expand All @@ -90,10 +92,10 @@ parallel_show_output = True
[testenv:exit_code]
# to see how the InvocationError is displayed, use
# PYTHONPATH=.:$PYTHONPATH python3 -m tox -e exit_code
basepython = python3.7
basepython = python3.8
description = commands with several exit codes
skip_install = True
commands = python3.7 -c "import sys; sys.exit(139)"
commands = python3.8 -c "import sys; sys.exit(139)"

[testenv:X]
description = print the positional arguments passed in with echo
Expand Down Expand Up @@ -150,7 +152,7 @@ known_third_party = apiclient,docutils,filelock,flaky,freezegun,git,httplib2,oau
[testenv:release]
description = do a release, required posarg of the version number
basepython = python3.7
basepython = python3.8
passenv = *
deps = gitpython >= 2.1.10
towncrier >= 18.5.0
Expand All @@ -159,7 +161,7 @@ commands = python {toxinidir}/tasks/release.py --version {posargs}
[testenv:notify]
description = notify people about the release of the library
basepython = python3.7
basepython = python3.8
skip_install = true
passenv = *
deps = gitpython >= 2.1.10
Expand Down

0 comments on commit c85365e

Please sign in to comment.