From 749b6f0d74ac24a1447d1ab1ba2afde5adfe2a96 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 21 Jun 2018 16:57:49 -0700 Subject: [PATCH 1/5] Cache pip wheels between runs in Travis, refs #323 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 91009165..17d46803 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,12 +9,17 @@ python: script: - python setup.py test +cache: + directories: + - $HOME/.cache/pip + # This defines further stages that execute after the tests jobs: include: - stage: deploy latest.datasette.io if: branch = master AND type = push script: + - pip install -U pip wheel - pip install . - npm install -g now - python tests/fixtures.py fixtures.db fixtures.json From b9046332c4ce498ab1c363cf579ebc5586f304ac Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 21 Jun 2018 19:51:10 -0700 Subject: [PATCH 2/5] Tell pip to use explicit download cache --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17d46803..aec6d488 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ python: # Executed for 3.5 AND 3.5 as the first "test" stage: script: + - pip install -U pip wheel + - pip install --download-cache /home/travis/.cache/pip . - python setup.py test cache: @@ -19,8 +21,7 @@ jobs: - stage: deploy latest.datasette.io if: branch = master AND type = push script: - - pip install -U pip wheel - - pip install . + - pip install --download-cache /home/travis/.cache/pip . - npm install -g now - python tests/fixtures.py fixtures.db fixtures.json - export ALIAS=`echo $TRAVIS_COMMIT | cut -c 1-7` From 22831a1ac82a2e34c06dd3f753e9928ad9c95725 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 21 Jun 2018 19:53:22 -0700 Subject: [PATCH 3/5] Don't use --download-cache argument --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index aec6d488..0a5375f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ python: # Executed for 3.5 AND 3.5 as the first "test" stage: script: - pip install -U pip wheel - - pip install --download-cache /home/travis/.cache/pip . + - pip install . - python setup.py test cache: @@ -21,7 +21,7 @@ jobs: - stage: deploy latest.datasette.io if: branch = master AND type = push script: - - pip install --download-cache /home/travis/.cache/pip . + - pip install . - npm install -g now - python tests/fixtures.py fixtures.db fixtures.json - export ALIAS=`echo $TRAVIS_COMMIT | cut -c 1-7` From 69b3a6c7ddf0e4e188a600ae50949c2b6ddc166a Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 21 Jun 2018 19:59:26 -0700 Subject: [PATCH 4/5] Run pytest manually python setup.py test appeared to still download a bunch of stuff https://travis-ci.org/simonw/datasette/jobs/395306188 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0a5375f0..f272ab38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,8 @@ python: # Executed for 3.5 AND 3.5 as the first "test" stage: script: - pip install -U pip wheel - - pip install . - - python setup.py test + - pip install .[test] + - pytest cache: directories: From 7d7f5f61fd6dca3385386a657a13057680d8ddd7 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Thu, 21 Jun 2018 20:03:54 -0700 Subject: [PATCH 5/5] Use extras_require so pip can install test dependencies https://github.com/pypa/pip/issues/1197#issuecomment-228939212 --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 79b1a519..67253a7f 100644 --- a/setup.py +++ b/setup.py @@ -47,10 +47,15 @@ setup( datasette=datasette.cli:cli ''', setup_requires=['pytest-runner'], + extras_require={ + 'test': [ + 'pytest==3.6.0', + 'aiohttp==2.3.2', + 'beautifulsoup4==4.6.0', + ] + }, tests_require=[ - 'pytest==3.6.0', - 'aiohttp==2.3.2', - 'beautifulsoup4==4.6.0', + 'datasette[test]', ], classifiers=[ 'Development Status :: 4 - Beta',