Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Warren <bmw@users.noreply.github.com>2018-01-04 04:49:22 +0300
committerohemorange <ebportnoy@gmail.com>2018-01-04 04:49:22 +0300
commit5388842e5b3868e29caf545fb771a23e7fce4143 (patch)
tree2ac062f336770e657c0b71a799b95efa3bb725fa
parented2168aaa8c8a7e1bef449e60167b53d501d173a (diff)
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
-rw-r--r--.gitignore3
-rw-r--r--pytest.ini2
-rwxr-xr-xtools/install_and_test.sh2
-rwxr-xr-xtools/pytest.sh15
-rwxr-xr-xtox.cover.sh3
-rw-r--r--tox.ini9
6 files changed, 32 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index b63e40d1c..e018cf938 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,3 +35,6 @@ tests/letstest/*.pem
tests/letstest/venv/
.venv
+
+# pytest cache
+/.cache
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 000000000..b64550cb7
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,2 @@
+[pytest]
+addopts = --quiet
diff --git a/tools/install_and_test.sh b/tools/install_and_test.sh
index 25b6d548a..0d39e0594 100755
--- a/tools/install_and_test.sh
+++ b/tools/install_and_test.sh
@@ -23,5 +23,5 @@ for requirement in "$@" ; do
# See https://travis-ci.org/certbot/certbot/jobs/308774157#L1333.
pkg=$(echo "$pkg" | tr - _)
fi
- pytest --numprocesses auto --quiet --pyargs $pkg
+ "$(dirname $0)/pytest.sh" --pyargs $pkg
done
diff --git a/tools/pytest.sh b/tools/pytest.sh
new file mode 100755
index 000000000..8e3619d5d
--- /dev/null
+++ b/tools/pytest.sh
@@ -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" "$@"
diff --git a/tox.cover.sh b/tox.cover.sh
index 2b5a3cf19..bc0e5a8bf 100755
--- a/tox.cover.sh
+++ b/tox.cover.sh
@@ -51,7 +51,8 @@ cover () {
fi
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
}
diff --git a/tox.ini b/tox.ini
index 6ebf681ed..20f5cda32 100644
--- a/tox.ini
+++ b/tox.ini
@@ -61,6 +61,7 @@ commands =
deps =
setuptools==36.8.0
wheel==0.29.0
+passenv = TRAVIS
[testenv]
commands =
@@ -69,12 +70,16 @@ commands =
setenv =
PYTHONPATH = {toxinidir}
PYTHONHASHSEED = 0
+passenv =
+ {[testenv:py26]passenv}
[testenv:py33]
commands =
{[testenv]commands}
deps =
wheel==0.29.0
+passenv =
+ {[testenv]passenv}
[testenv:py27-oldest]
commands =
@@ -82,6 +87,8 @@ commands =
setenv =
{[testenv]setenv}
CERTBOT_OLDEST=1
+passenv =
+ {[testenv]passenv}
[testenv:py27_install]
basepython = python2.7
@@ -93,6 +100,8 @@ basepython = python2.7
commands =
{[base]install_packages}
./tox.cover.sh
+passenv =
+ {[testenv]passenv}
[testenv:lint]
# recent versions of pylint do not support Python 2.6 (#97, #187)