Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Use travis_retry in tox (via install_command), not on tox
Browse files Browse the repository at this point in the history
This creates a wrapper script in bin/, exports `travis_retry` (a function)
into it and then injects this as `install_command` into tox.ini.

Closes pytest-dev#224
  • Loading branch information
blueyed authored and mfa committed May 17, 2017
1 parent 1294ce9 commit 13f294e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
17 changes: 15 additions & 2 deletions .travis.yml
Expand Up @@ -45,5 +45,18 @@ matrix:
- env: TESTENV=python3.4-master-sqlite
- env: TESTENV=python3.4-master-sqlite_file
install:
- travis_retry pip install tox
script: travis_retry tox -e $TESTENV
# Create pip wrapper script, using travis_retry (a function) and
# inject it into tox.ini.
- mkdir -p bin
- PATH=$PWD/bin:$PATH
- printf '#!/bin/sh\n' > bin/travis_retry_pip
- declare -f travis_retry >> bin/travis_retry_pip
- printf '\necho "Using pip-wrapper.." >&2\ntravis_retry pip "$@"' >> bin/travis_retry_pip
- chmod +x bin/travis_retry_pip
- sed -i.bak 's/^\[testenv\]/\0\ninstall_command = travis_retry_pip install {opts} {packages}/' tox.ini
- diff tox.ini tox.ini.bak && false || true
- sed -i.bak 's/whitelist_externals =/\0\n travis_retry_pip/' tox.ini
- diff tox.ini tox.ini.bak && false || true

- pip install tox
script: tox -e $TESTENV
17 changes: 15 additions & 2 deletions generate_configurations.py
Expand Up @@ -227,8 +227,21 @@ def make_travis_yml(envs):
allow_failures:
%(allow_failures)s
install:
- travis_retry pip install tox
script: travis_retry tox -e $TESTENV
# Create pip wrapper script, using travis_retry (a function) and
# inject it into tox.ini.
- mkdir -p bin
- PATH=$PWD/bin:$PATH
- printf '#!/bin/sh\\n' > bin/travis_retry_pip
- declare -f travis_retry >> bin/travis_retry_pip
- printf '\\necho "Using pip-wrapper.." >&2\\ntravis_retry pip "$@"' >> bin/travis_retry_pip
- chmod +x bin/travis_retry_pip
- sed -i.bak 's/^\[testenv\]/\\0\\ninstall_command = travis_retry_pip install {opts} {packages}/' tox.ini
- diff tox.ini tox.ini.bak && return 1 || true
- sed -i.bak 's/whitelist_externals =/\\0\\n travis_retry_pip/' tox.ini
- diff tox.ini tox.ini.bak && return 1 || true
- pip install tox
script: tox -e $TESTENV
""").strip("\n")
testenvs = '\n'.join(' - TESTENV=%s' % testenv_name(env) for env in envs)
checkenvs = '\n'.join(' - TESTENV=checkqa-%s' %
Expand Down

0 comments on commit 13f294e

Please sign in to comment.