mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 00:22:04 +02:00
Fix pytest on macOS in Travis (#5360)
* Add tools/pytest.sh * pass TRAVIS through in tox.ini * Use tools/pytest.sh to run pytest * Add quiet to pytest.ini * ignore pytest cache
This commit is contained in:
@@ -35,3 +35,6 @@ tests/letstest/*.pem
|
|||||||
tests/letstest/venv/
|
tests/letstest/venv/
|
||||||
|
|
||||||
.venv
|
.venv
|
||||||
|
|
||||||
|
# pytest cache
|
||||||
|
/.cache
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[pytest]
|
||||||
|
addopts = --quiet
|
||||||
@@ -23,5 +23,5 @@ for requirement in "$@" ; do
|
|||||||
# See https://travis-ci.org/certbot/certbot/jobs/308774157#L1333.
|
# See https://travis-ci.org/certbot/certbot/jobs/308774157#L1333.
|
||||||
pkg=$(echo "$pkg" | tr - _)
|
pkg=$(echo "$pkg" | tr - _)
|
||||||
fi
|
fi
|
||||||
pytest --numprocesses auto --quiet --pyargs $pkg
|
"$(dirname $0)/pytest.sh" --pyargs $pkg
|
||||||
done
|
done
|
||||||
|
|||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Runs pytest with the provided arguments, adding --numprocesses to the command
|
||||||
|
# line. This argument is set to "auto" if the environmnent variable TRAVIS is
|
||||||
|
# not set, otherwise, it is set to 2. This works around
|
||||||
|
# https://github.com/pytest-dev/pytest-xdist/issues/9. Currently every Travis
|
||||||
|
# environnment provides two cores. See
|
||||||
|
# https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments.
|
||||||
|
|
||||||
|
if ${TRAVIS:-false}; then
|
||||||
|
NUMPROCESSES="2"
|
||||||
|
else
|
||||||
|
NUMPROCESSES="auto"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pytest --numprocesses "$NUMPROCESSES" "$@"
|
||||||
+2
-1
@@ -51,7 +51,8 @@ cover () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
pkg_dir=$(echo "$1" | tr _ -)
|
pkg_dir=$(echo "$1" | tr _ -)
|
||||||
pytest --cov "$pkg_dir" --cov-append --cov-report= --numprocesses auto --pyargs "$1"
|
pytest="$(dirname $0)/tools/pytest.sh"
|
||||||
|
"$pytest" --cov "$pkg_dir" --cov-append --cov-report= --pyargs "$1"
|
||||||
coverage report --fail-under="$min" --include="$pkg_dir/*" --show-missing
|
coverage report --fail-under="$min" --include="$pkg_dir/*" --show-missing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ commands =
|
|||||||
deps =
|
deps =
|
||||||
setuptools==36.8.0
|
setuptools==36.8.0
|
||||||
wheel==0.29.0
|
wheel==0.29.0
|
||||||
|
passenv = TRAVIS
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands =
|
commands =
|
||||||
@@ -69,12 +70,16 @@ commands =
|
|||||||
setenv =
|
setenv =
|
||||||
PYTHONPATH = {toxinidir}
|
PYTHONPATH = {toxinidir}
|
||||||
PYTHONHASHSEED = 0
|
PYTHONHASHSEED = 0
|
||||||
|
passenv =
|
||||||
|
{[testenv:py26]passenv}
|
||||||
|
|
||||||
[testenv:py33]
|
[testenv:py33]
|
||||||
commands =
|
commands =
|
||||||
{[testenv]commands}
|
{[testenv]commands}
|
||||||
deps =
|
deps =
|
||||||
wheel==0.29.0
|
wheel==0.29.0
|
||||||
|
passenv =
|
||||||
|
{[testenv]passenv}
|
||||||
|
|
||||||
[testenv:py27-oldest]
|
[testenv:py27-oldest]
|
||||||
commands =
|
commands =
|
||||||
@@ -82,6 +87,8 @@ commands =
|
|||||||
setenv =
|
setenv =
|
||||||
{[testenv]setenv}
|
{[testenv]setenv}
|
||||||
CERTBOT_OLDEST=1
|
CERTBOT_OLDEST=1
|
||||||
|
passenv =
|
||||||
|
{[testenv]passenv}
|
||||||
|
|
||||||
[testenv:py27_install]
|
[testenv:py27_install]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
@@ -93,6 +100,8 @@ basepython = python2.7
|
|||||||
commands =
|
commands =
|
||||||
{[base]install_packages}
|
{[base]install_packages}
|
||||||
./tox.cover.sh
|
./tox.cover.sh
|
||||||
|
passenv =
|
||||||
|
{[testenv]passenv}
|
||||||
|
|
||||||
[testenv:lint]
|
[testenv:lint]
|
||||||
# recent versions of pylint do not support Python 2.6 (#97, #187)
|
# recent versions of pylint do not support Python 2.6 (#97, #187)
|
||||||
|
|||||||
Reference in New Issue
Block a user