Fix macOS tests (#6437)

* Don't try to install installed packages.

* Test with any version of python3 on macOS.

* move file and fix mode

* ignore stderr too

* remove extra set -e

* no linux failures
This commit is contained in:
Brad Warren 2018-10-23 00:20:53 -07:00 committed by Joona Hoikkala
parent c99688f175
commit 5e9a5e4daa
2 changed files with 19 additions and 2 deletions

View file

@ -12,7 +12,7 @@ before_install:
- cp .travis.yml /tmp/travis.yml
- git pull origin master --strategy=recursive --strategy-option=theirs --no-edit
- if ! git diff .travis.yml /tmp/travis.yml ; then echo "Please merge master into test-everything"; exit 1; fi
- '([ $TRAVIS_OS_NAME == linux ] && dpkg -s libaugeas0) || (brew update && brew install augeas && brew upgrade python python3 && brew link python)'
- '[ "$TRAVIS_OS_NAME" != osx ] || tests/travis-macos-setup.sh'
before_script:
- 'if [ $TRAVIS_OS_NAME = osx ] ; then ulimit -n 1024 ; fi'
@ -121,7 +121,7 @@ matrix:
env: TOXENV=py27
os: osx
- language: generic
env: TOXENV=py37
env: TOXENV=py3
os: osx

17
tests/travis-macos-setup.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/bash -e
#
# Set up the test environment for macOS on Travis.
# Install the given package with brew if it's not already installed.
brew_install() {
if ! brew list "$1" > /dev/null 2>&1; then
brew install "$1"
fi
}
brew_install augeas
brew_install python
brew_install python3
# Ensure we use python from brew.
brew link python