Skip to content

Commit

Permalink
Fix CI and reduce CI time (#739)
Browse files Browse the repository at this point in the history
* test newer python
* use yaml.safe_load
* pin PyYAML version for Python 3.4
* pass user flag to pip when needed
* move slow jobs to the top to reduce CI time

Signed-off-by: Mikael Arguedas <mikael.arguedas@gmail.com>
  • Loading branch information
mikaelarguedas authored Mar 12, 2020
1 parent 2977726 commit d6e5f62
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
33 changes: 20 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
language: python
matrix:
include:
- os: osx
language: generic
env: PYTHON_INSTALLER=pyenv TRAVIS_PYTHON_VERSION=2.7.14
- os: osx
language: generic
env: PYTHON_INSTALLER=pyenv TRAVIS_PYTHON_VERSION=3.6.4
- os: osx
language: generic
env:
- PYTHON_INSTALLER=brew
- PIP_USER_FLAG="--user"
- os: linux
python: 2.7
- os: linux
python: 3.4
python: 3.4 # When support for 3.4 is removed unpin the PyYAML version below.
- os: linux
python: 3.5
- os: linux
python: 3.6
- os: osx
language: generic
env: PYTHON_INSTALLER=brew
- os: osx
language: generic
env: PYTHON_INSTALLER=pyenv TRAVIS_PYTHON_VERSION=2.7.14
- os: osx
language: generic
env: PYTHON_INSTALLER=pyenv TRAVIS_PYTHON_VERSION=3.6.4
- os: linux
python: 3.7
- os: linux
python: 3.8

# command to install dependencies
install:
- source .travis/install.sh
- python --version
- python -m pip install PyYAML argparse rospkg vcstools catkin_pkg python-dateutil rosdistro
- python -m pip install -e .
- python -m pip install nose coverage flake8 mock codecov
- if [ $TRAVIS_PYTHON_VERSION == "3.4" ]; then python -m pip install PyYAML==5.2; fi # Forcing PyYAML 5.2 while we retain Python 3.4 support PyYAML 5.3 and higher does not support Python 3.4
- python -m pip install $PIP_USER_FLAG PyYAML argparse rospkg vcstools catkin_pkg python-dateutil rosdistro
- python -m pip install $PIP_USER_FLAG -e .
- python -m pip install $PIP_USER_FLAG nose coverage flake8 mock codecov
# command to run tests
script:
- python -m nose --with-coverage --cover-package=rosdep2 --with-xunit test
Expand Down
6 changes: 3 additions & 3 deletions test/test_rosdep_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ def create_test_SourcesListLoader():
def get_cache_raw():
cache_rosdep_path = os.path.join(get_cache_dir(), '0a12d6e7b0d47be9b76e7726720e4cb79528cbaa')
with open(cache_rosdep_path) as f:
cache_raw = yaml.load(f.read())
cache_raw = yaml.safe_load(f.read())
return cache_raw


def get_cache_raw_python():
cache_rosdep_path = os.path.join(get_cache_dir(), 'f6f4ef95664e373cd4754501337fa217f5b55d91')
with open(cache_rosdep_path) as f:
cache_raw = yaml.load(f.read())
cache_raw = yaml.safe_load(f.read())
return cache_raw


Expand Down Expand Up @@ -125,7 +125,7 @@ def test_RosdepDefinition():
pass

# - test w/valid data
d2 = yaml.load(FAKE_TINYXML_RULE)['testtinyxml']
d2 = yaml.safe_load(FAKE_TINYXML_RULE)['testtinyxml']
definition = RosdepDefinition('d2', d2, 'file2.txt')
# - tripwire
str(definition)
Expand Down

0 comments on commit d6e5f62

Please sign in to comment.