From c5425156c80727dd8fc1a8f09631d71eae09264a Mon Sep 17 00:00:00 2001 From: Gary van der Merwe Date: Mon, 11 May 2015 18:40:27 +0200 Subject: [PATCH] Rework travis so that it uses containers & caches pip downloads. --- .travis.yml | 40 ++++++++++++++++++++++++++-------------- setup.py | 4 ++-- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3c7e55fac..72b8d4317 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,28 @@ language: python -# Workaround to make 2.7 use system site packages, and 2.6 and 3.4 not use system -# site packages. -# https://github.com/travis-ci/travis-ci/issues/2219#issuecomment-41804942 -python: -- "2.6" -- "2.7_with_system_site_packages" -- "3.4" -- "pypy" +sudo: false +env: + global: TEST_RUNNER=unittest PYTHONHASHSEED=random +matrix: + include: + - python: "2.6" + env: TEST_RUNNER=unittest2.__main__ TEST_REQUIRE="gevent geventhttpclient fastimport unittest2" + - python: "2.7" + env: TEST_REQUIRE="gevent geventhttpclient fastimport" + - python: "pypy" + env: TEST_REQUIRE="fastimport" + - python: "3.4" + env: TEST_REQUIRE= +cache: + directories: + - $HOME/.cache/pip script: - - PYTHONHASHSEED=random python setup.py test - - make check-noextensions -install: - - sudo apt-get update - - sudo apt-get install -qq git python-setuptools python-gevent python-fastimport python-mock - - if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then pip install unittest2; fi + - pip install pip --upgrade + - pip install $TEST_REQUIRE + + # Test without c extensions + - python -m $TEST_RUNNER dulwich.tests.test_suite + + # Test with c extensions + - python setup.py build_ext -i + - python -m $TEST_RUNNER dulwich.tests.test_suite + diff --git a/setup.py b/setup.py index 95028cebd..e760ec480 100755 --- a/setup.py +++ b/setup.py @@ -50,12 +50,12 @@ def has_ext_modules(self): tests_require = ['fastimport', 'mock'] if not '__pypy__' in sys.modules and not sys.platform == 'win32': tests_require.extend(['gevent', 'geventhttpclient']) + if sys.version_info < (2, 7): + tests_require.append('unittest2') else: # fastimport, gevent, geventhttpclient are not available for PY3 # mock only used for test_swift, which requires gevent/geventhttpclient tests_require = [] -if sys.version_info < (2, 7): - tests_require.append('unittest2') if sys.version_info[0] > 2 and sys.platform == 'win32': # C Modules don't build for python3 windows, and prevent tests from running