diff --git a/.travis.yml b/.travis.yml index a09359e..227b69e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,9 @@ language: python python: - - "2.7" - - "2.6" -install: pip install -r requirements.txt -script: python runtests.py + - 2.6 + - 2.7 + - 3.2 +script: make travis +install: + - pip install nose + - pip install . --use-mirrors diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a7b1860 --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +SHELL := /bin/bash + +# these files should pass pyflakes +# exclude ./env/, which may contain virtualenv packages +PYFLAKES_WHITELIST=$(shell find . -name "*.py" ! -path "./docs/*" ! -path "./tests/*" \ + ! -path "./requests/packages/*" ! -path "./env/*" \ + ! -path "./requests/__init__.py" ! -path "./requests/compat.py") + +# hack: if pyflakes is available, set this to the location of pyflakes +# if it's not, e.g., in the Python 3 or PyPy Jenkins environments, set it to +# the location of the no-op `true` command. +PYFLAKES_IF_AVAILABLE=$(shell if which pyflakes > /dev/null ; \ + then which pyflakes; \ + else which true; fi ) + +# test_requests_ext.py depends on external services, and async doesn't work under Python 3 +# Travis/Jenkins should be ensuring that all other tests pass on all supported versions +CI_TESTS=$(shell find ,/ -name "*.py" ! -name "test_requests_ext.py" ! -name "test_requests_async.py") + +init: + python setup.py develop + pip install -r requirements.txt + +test: + nosetests ./ + +lazy: + nosetests --with-color ./ + +simple: + nosetests ./ + +pyflakes: + pyflakes ${PYFLAKES_WHITELIST} + +cipyflakes: + ${PYFLAKES_IF_AVAILABLE} ${PYFLAKES_WHITELIST} + +citests: + nosetests ${CI_TESTS} --with-xunit --xunit-file=junit-report.xml + +ci: citests cipyflakes + +travis: citests + +# compute statistics of various kinds +lemonade: + -pyflakes vaporize > violations.pyflakes.txt + # HTML output will be available in the default location, ./cover/ + nosetests --with-coverage --cover-html --cover-package=vaporize ${CI_TESTS} ./tests/* + +site: + cd docs; make html + +clean: + git clean -Xfd + +docs: site diff --git a/runtests.py b/runtests.py deleted file mode 100755 index a072e33..0000000 --- a/runtests.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/home/kolanos/Web/Vaporize/env/bin/python -# EASY-INSTALL-ENTRY-SCRIPT: 'nose==1.1.2','console_scripts','nosetests' -__requires__ = 'nose==1.1.2' -import sys -from pkg_resources import load_entry_point - -if __name__ == '__main__': - sys.exit( - load_entry_point('nose==1.1.2', 'console_scripts', 'nosetests')() - ) diff --git a/vaporize/tests/__init__.py b/tests/__init__.py similarity index 100% rename from vaporize/tests/__init__.py rename to tests/__init__.py diff --git a/vaporize/tests/mock.py b/tests/mock.py similarity index 100% rename from vaporize/tests/mock.py rename to tests/mock.py diff --git a/vaporize/tests/test_servers.py b/tests/test_servers.py similarity index 99% rename from vaporize/tests/test_servers.py rename to tests/test_servers.py index 2d478f9..52583c4 100644 --- a/vaporize/tests/test_servers.py +++ b/tests/test_servers.py @@ -3,6 +3,10 @@ from .mock import mock, handle_request_mock +import sys +import os +sys.path.insert(0, os.path.abspath('..')) + import vaporize