Skip to content

Commit

Permalink
Increase test coverage on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Oct 31, 2015
1 parent b86df3b commit 2502c67
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile for the pip accelerator.
#
# Author: Peter Odding <peter.odding@paylogic.com>
# Last Change: October 30, 2015
# Last Change: October 31, 2015
# URL: https://github.com/paylogic/pip-accel

WORKON_HOME ?= $(HOME)/.virtualenvs
Expand Down Expand Up @@ -42,7 +42,7 @@ test: install

coverage: install
test -x "$(VIRTUAL_ENV)/bin/coverage" || ($(ACTIVATE) && pip-accel install --quiet coverage)
$(ACTIVATE) && scripts/collect-full-coverage
$(ACTIVATE) && scripts/collect-full-coverage.sh
# Report coverage statistics on the command line.
$(ACTIVATE) && coverage report
# Generate an HTML report of coverage statistics.
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ environment:
secure: DCxZQaYFWVR0zWqjTPXhhlRlLdmKNMS2qDUwIR8jRar13clunOqJIaXn+vKInS7g
install:
- cmd: '"%PYTHON%\Scripts\pip.exe" install . https://github.com/xolox/coveralls-python/archive/master.zip'
- cmd: 'scripts\collect-full-coverage.cmd'
build: off
test_script:
- cmd: '"%PYTHON%\Scripts\coverage.exe" run setup.py test'
Expand Down
4 changes: 2 additions & 2 deletions pip_accel/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def test_s3_backend(self):
This test downloads, builds and installs pep8 1.6.2 to verify that the
S3 cache backend works. It depends on FakeS3 (refer to the shell script
``scripts/collect-full-coverage`` in the pip-accel git repository).
``scripts/collect-full-coverage.sh`` in the pip-accel git repository).
This test uses a temporary binary index which it wipes after a
successful installation and then it installs the exact same package
Expand All @@ -343,7 +343,7 @@ def test_s3_backend(self):
if not (fakes3_pid and fakes3_root):
return self.skipTest("""
Skipping S3 cache backend test because it looks like FakeS3
isn't running (see scripts/collect-full-coverage).
isn't running (see scripts/collect-full-coverage.sh).
""")
pip_install_args = ['--ignore-installed', '--no-binary=:all:', 'pep8==1.6.2']
# Initialize an instance of pip-accel with an empty cache.
Expand Down
32 changes: 32 additions & 0 deletions scripts/collect-full-coverage.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
:: Windows batch script to prepare for the pip-accel test suite.
::
:: Author: Peter Odding <peter.odding@paylogic.com>
:: Last Change: October 31, 2015
:: URL: https://github.com/paylogic/pip-accel
::
:: This Windows batch script is used to run the pip-accel test suite on
:: AppVeyor CI with increased coverage collection (which requires some
:: preparations). It installs/upgrades/removes several Python packages whose
:: installation, upgrade and/or removal is tested in the test suite to make
:: sure that the test suite starts from a known state.

:: Downgrade setuptools so that the test suite can verify that setuptools is
:: upgraded to >= 0.8 when a binary wheel is installed. Performing this
:: downgrade inside the test suite process doesn't work as expected because pip
:: (pkg_resources) will still think the newer version is installed (due to
:: caching without proper cache invalidation by pkg_resources).
"%PYTHON%\Scripts\pip.exe" install --no-binary=:all: "setuptools < 0.8"

:: Install requests==2.6.0 so the test suite can downgrade to requests==2.2.1
:: (to verify that downgrading of packages works). Ideally the test suite
:: should just be able to install requests==2.6.0 and then downgrade to
:: requests==2.2.1 but unfortunately this doesn't work reliably in the same
:: Python process due to (what looks like) caching in the pkg_resources module
:: bundled with pip (which in turn causes a variety of confusing internal
:: errors in pip and pip-accel).
"%PYTHON%\Scripts\pip.exe" install requests==2.6.0

:: Remove iPython so the test suite can install iPython in a clean environment,
:: allowing the test suite to compare the files installed and removed by pip
:: and pip-accel.
"%PYTHON%\Scripts\pip.exe" uninstall --yes ipython
File renamed without changes.

0 comments on commit 2502c67

Please sign in to comment.