diff --git a/.travis.yml b/.travis.yml index ef95f20d..2e253db7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,8 @@ python: - 2.7 - pypy - 3.3 -install: - - pip install pytest pytest-cov python-coveralls --use-mirrors - - pip install . --use-mirrors script: - - py.test --cov ./httpie --cov ./tests --doctest-modules --verbose ./httpie ./tests + - make after_success: + - pip install python-coveralls - coveralls diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index ae58572b..afd5c6ab 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -38,12 +38,9 @@ Development Environment # (Recommended: create a new virtualenv) - # Install dev. requirements: - pip install -r requirements-dev.txt - - # Install HTTPie in editable mode - # (the `http' command will point to your working copy): - pip install --upgrade --force-reinstall --editable . + # Install dev. requirements and also HTTPie (in editable mode + # so that the `http' command will point to your working copy): + make Making Changes @@ -66,10 +63,13 @@ HTTPie uses `pytest`_ and `Tox`_. ### Running all tests: # Current Python - python setup.py test + make test - # All the supported and available Pythons - tox + # Current Python with coverage + make test-cover + + # All the supported and available Pythons via Tox + make test-tox ### Running specific tests: diff --git a/MakeFile b/MakeFile new file mode 100644 index 00000000..1c8868bf --- /dev/null +++ b/MakeFile @@ -0,0 +1,67 @@ +VERSION=$(shell grep __version__ httpie/__init__.py) +REQUIREMENTS="requirements-dev.txt" +TAG="\n\n\033[0;32m\#\#\# " +END=" \#\#\# \033[0m\n" + +all: test + +uninstall-httpie: + @echo $(TAG)Removing existing installation of HTTPie$(END) + - pip uninstall --yes httpie >/dev/null + ! which http + @echo + +uninstall-all: uninstall-httpie + - pip uninstall --yes -r $(REQUIREMENTS) + +init: uninstall-httpie + @echo $(TAG)Installing dev requirements$(END) + pip install --upgrade -r $(REQUIREMENTS) + @echo $(TAG)Installing HTTPie$(END) + pip install --upgrade --editable . + @echo + +test: init + @echo $(TAG)Running tests in on current Python in parallel and with coverage $(END) + py.test --cov ./httpie --cov ./tests -n 8 --doctest-modules --verbose ./httpie ./tests + @echo + +test-tox: init + @echo $(TAG)Running tests on all Pythons via Tox$(END) + tox + @echo + +test-dist: test-sdist test-bdist-wheel + @echo + +test-sdist: clean uninstall-httpie + @echo $(TAG)Testing sdist build an installation$(END) + python setup.py sdist + pip install --force-reinstall --upgrade dist/*.gz + which http + @echo + +test-bdist-wheel: clean uninstall-httpie + @echo $(TAG)Testing wheel build an installation$(END) + python setup.py bdist_wheel + pip install --force-reinstall --upgrade dist/*.whl + which http + @echo + +# This tests everything, even this Makefile. +test-all: uninstall-all clean init test test-tox test-dist + +publish: test-all + @echo $(TAG)Testing wheel build an installation$(END) + @echo "$(VERSION)" + @echo "$(VERSION)" | grep -q "dev" && echo "!!!Not publishing dev version!!!" && exit 1 + python setup.py register + python setup.py sdist upload + python setup.py bdist_wheel upload + @echo + +clean: + @echo $(TAG)Cleaning up$(END) + rm -rf .tox *.egg dist build .coverage + find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print + @echo diff --git a/requirements-dev.txt b/requirements-dev.txt index 7000c7e6..bd00cc55 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ tox pytest pytest-xdist +pytest-cov docutils diff --git a/setup.py b/setup.py index 173d84f8..8d9c067f 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,14 @@ import sys import codecs -from setuptools import setup +from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand import httpie class PyTest(TestCommand): + # `$ python setup.py test' simply installs minimal requirements + # and runs the tests with no fancy stuff like parallel execution. def finalize_options(self): TestCommand.finalize_options(self) self.test_suite = True @@ -45,7 +47,6 @@ def long_description(): with codecs.open('README.rst', encoding='utf8') as f: return f.read() - setup( name='httpie', version=httpie.__version__, @@ -56,7 +57,7 @@ setup( author=httpie.__author__, author_email='jakub@roztocil.name', license=httpie.__licence__, - packages=['httpie', 'httpie.plugins'], + packages=find_packages(), entry_points={ 'console_scripts': [ 'http = httpie.__main__:main', @@ -72,6 +73,8 @@ setup( 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.1', 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', 'Environment :: Console', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', diff --git a/tests/test_output.py b/tests/test_output.py index edb5a26c..8cef773e 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -5,7 +5,6 @@ from httpie.output.processors.colors import get_lexer from utils import TestEnvironment, http, httpbin, HTTP_OK, COLOR, CRLF - class TestVerboseFlag: def test_verbose(self): r = http('--verbose', 'GET', httpbin('/get'), 'test-header:__test__') diff --git a/tox.ini b/tox.ini index 95f45628..3e37c178 100644 --- a/tox.ini +++ b/tox.ini @@ -15,4 +15,4 @@ deps = pytest-xdist commands = - py.test --doctest-modules --basetemp={envtmpdir} -n 8 {posargs:./tests ./httpie} + py.test -n 8 --doctest-modules --basetemp={envtmpdir} {posargs:./tests ./httpie}