mirror of
https://github.com/httpie/cli.git
synced 2025-01-13 00:58:36 +01:00
Fixed tox.ini and improved tests and CONTRIBUTING.txt
This commit is contained in:
parent
34c6958dc8
commit
84b81c00ea
@ -1,12 +1,13 @@
|
|||||||
|
######################
|
||||||
Contributing to HTTPie
|
Contributing to HTTPie
|
||||||
######################
|
######################
|
||||||
|
|
||||||
Bug reports and code and documentation patches are greatly appreciated. You can
|
Bug reports and code and documentation patches are welcome. You can
|
||||||
also help by using the development version of HTTPie and reporting any bugs you
|
help this project also by using the development version of HTTPie
|
||||||
might encounter.
|
and by reporting any bugs you might encounter.
|
||||||
|
|
||||||
Bug Reports
|
1. Reporting bugs
|
||||||
===========
|
=================
|
||||||
|
|
||||||
**It's important that you provide the full command argument list
|
**It's important that you provide the full command argument list
|
||||||
as well as the output of the failing command.**
|
as well as the output of the failing command.**
|
||||||
@ -15,12 +16,12 @@ to your bug report, e.g.:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
$ http --debug [arguments that trigger the error]
|
$ http --debug [COMPLETE ARGUMENT LIST THAT TRIGGERS THE ERROR]
|
||||||
[complete output]
|
[COMPLETE OUTPUT]
|
||||||
|
|
||||||
|
|
||||||
Contributing Code and Documentation
|
2. Contributing Code and Docs
|
||||||
===================================
|
=============================
|
||||||
|
|
||||||
Before working on a new feature or a bug, please browse `existing issues`_
|
Before working on a new feature or a bug, please browse `existing issues`_
|
||||||
to see whether it has been previously discussed. If the change in question
|
to see whether it has been previously discussed. If the change in question
|
||||||
@ -28,8 +29,11 @@ is a bigger one, it's always good to discuss before your starting working on
|
|||||||
it.
|
it.
|
||||||
|
|
||||||
|
|
||||||
Development Environment
|
Creating Development Environment
|
||||||
-----------------------
|
--------------------------------
|
||||||
|
|
||||||
|
Go to https://github.com/jkbrzt/httpie and fork the project repository.
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@ -52,44 +56,56 @@ Making Changes
|
|||||||
Please make sure your changes conform to `Style Guide for Python Code`_ (PEP8).
|
Please make sure your changes conform to `Style Guide for Python Code`_ (PEP8).
|
||||||
|
|
||||||
|
|
||||||
Tests
|
Testing
|
||||||
-----
|
-------
|
||||||
|
|
||||||
Before opening a pull requests, please make sure the `test suite`_ passes
|
Before opening a pull requests, please make sure the `test suite`_ passes
|
||||||
in all of the `supported Python environments`_. You should also **add tests
|
in all of the `supported Python environments`_. You should also add tests
|
||||||
for any new features and bug fixes**.
|
for any new features and bug fixes.
|
||||||
|
|
||||||
HTTPie uses `pytest`_ and `Tox`_.
|
HTTPie uses `pytest`_ and `Tox`_ for testing.
|
||||||
|
|
||||||
|
|
||||||
|
Running all tests:
|
||||||
|
******************
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
### Running all tests:
|
# Run all tests on the current Python interpreter
|
||||||
|
|
||||||
# Current Python
|
|
||||||
make test
|
make test
|
||||||
|
|
||||||
# Current Python with coverage
|
# Run all tests on the current Python with coverage
|
||||||
make test-cover
|
make test-cover
|
||||||
|
|
||||||
# All the supported and available Pythons via Tox
|
# Run all tests in all of the supported and available Pythons via Tox
|
||||||
make test-tox
|
make test-tox
|
||||||
|
|
||||||
### Running specific tests:
|
|
||||||
|
|
||||||
# Current Python
|
Running specific tests:
|
||||||
pytest tests/test_uploads.py
|
***********************
|
||||||
|
|
||||||
# All Pythons
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Run specific tests on the current Python
|
||||||
|
py.test tests/test_uploads.py
|
||||||
|
py.test tests/test_uploads.py::TestMultipartFormDataFileUpload
|
||||||
|
py.test tests/test_uploads.py::TestMultipartFormDataFileUpload::test_upload_ok
|
||||||
|
|
||||||
|
# Run specific tests on the on all Pythons via Tox
|
||||||
tox -- tests/test_uploads.py --verbose
|
tox -- tests/test_uploads.py --verbose
|
||||||
|
tox -- tests/test_uploads.py::TestMultipartFormDataFileUpload --verbose
|
||||||
|
tox -- tests/test_uploads.py::TestMultipartFormDataFileUpload::test_upload_ok --verbose
|
||||||
|
|
||||||
|
|
||||||
Don't forget to add yourself to `AUTHORS.rst`_.
|
-----
|
||||||
|
|
||||||
|
Don't forget to add yourself to `AUTHORS`_!
|
||||||
|
|
||||||
|
|
||||||
.. _Tox: http://tox.testrun.org
|
.. _Tox: http://tox.testrun.org
|
||||||
.. _supported Python environments: https://github.com/jkbrzt/httpie/blob/master/tox.ini
|
.. _supported Python environments: https://github.com/jkbrzt/httpie/blob/master/tox.ini
|
||||||
.. _existing issues: https://github.com/jkbrzt/httpie/issues?state=open
|
.. _existing issues: https://github.com/jkbrzt/httpie/issues?state=open
|
||||||
.. _AUTHORS.rst: https://github.com/jkbrzt/httpie/blob/master/AUTHORS.rst
|
.. _AUTHORS: https://github.com/jkbrzt/httpie/blob/master/AUTHORS.rst
|
||||||
.. _pytest: http://pytest.org/
|
.. _pytest: http://pytest.org/
|
||||||
.. _Style Guide for Python Code: http://python.org/dev/peps/pep-0008/
|
.. _Style Guide for Python Code: http://python.org/dev/peps/pep-0008/
|
||||||
.. _test suite: https://github.com/jkbrzt/httpie/tree/master/tests
|
.. _test suite: https://github.com/jkbrzt/httpie/tree/master/tests
|
||||||
|
8
Makefile
8
Makefile
@ -1,3 +1,7 @@
|
|||||||
|
#
|
||||||
|
# See ./CONTRIBUTING.rst
|
||||||
|
#
|
||||||
|
|
||||||
VERSION=$(shell grep __version__ httpie/__init__.py)
|
VERSION=$(shell grep __version__ httpie/__init__.py)
|
||||||
REQUIREMENTS="requirements-dev.txt"
|
REQUIREMENTS="requirements-dev.txt"
|
||||||
TAG="\n\n\033[0;32m\#\#\# "
|
TAG="\n\n\033[0;32m\#\#\# "
|
||||||
@ -7,6 +11,8 @@ all: test
|
|||||||
|
|
||||||
uninstall-httpie:
|
uninstall-httpie:
|
||||||
@echo $(TAG)Removing existing installation of HTTPie$(END)
|
@echo $(TAG)Removing existing installation of HTTPie$(END)
|
||||||
|
@echo "(NOTE: uninstall httpie manually if this fails)"
|
||||||
|
@echo
|
||||||
- pip uninstall --yes httpie >/dev/null
|
- pip uninstall --yes httpie >/dev/null
|
||||||
! which http
|
! which http
|
||||||
@echo
|
@echo
|
||||||
@ -22,7 +28,7 @@ init: uninstall-httpie
|
|||||||
@echo
|
@echo
|
||||||
|
|
||||||
test: init
|
test: init
|
||||||
@echo $(TAG)Running tests in on current Python with coverage $(END)
|
@echo $(TAG)Running tests on the current Python interpreter with coverage $(END)
|
||||||
py.test --cov ./httpie --cov ./tests --doctest-modules --verbose ./httpie ./tests
|
py.test --cov ./httpie --cov ./tests --doctest-modules --verbose ./httpie ./tests
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
@ -6,11 +6,11 @@ from httpie import __version__
|
|||||||
from httpie.compat import is_windows
|
from httpie.compat import is_windows
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_CONFIG_DIR = os.environ.get(
|
DEFAULT_CONFIG_DIR = str(os.environ.get(
|
||||||
'HTTPIE_CONFIG_DIR',
|
'HTTPIE_CONFIG_DIR',
|
||||||
os.path.expanduser('~/.httpie') if not is_windows else
|
os.path.expanduser('~/.httpie') if not is_windows else
|
||||||
os.path.expandvars(r'%APPDATA%\\httpie')
|
os.path.expandvars(r'%APPDATA%\\httpie')
|
||||||
)
|
))
|
||||||
|
|
||||||
|
|
||||||
class BaseConfigDict(dict):
|
class BaseConfigDict(dict):
|
||||||
|
@ -53,7 +53,7 @@ class TestEnvironment(Environment):
|
|||||||
stdout_isatty = True
|
stdout_isatty = True
|
||||||
is_windows = False
|
is_windows = False
|
||||||
|
|
||||||
_shutil = shutil # needed by __del__ (would get gc'd)
|
_shutil_rmtree = shutil.rmtree # needed by __del__ (would get gc'd)
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class TestEnvironment(Environment):
|
|||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.delete_config_dir:
|
if self.delete_config_dir:
|
||||||
self._shutil.rmtree(self.config_dir)
|
self._shutil_rmtree(self.config_dir)
|
||||||
|
|
||||||
|
|
||||||
def http(*args, **kwargs):
|
def http(*args, **kwargs):
|
||||||
|
16
tox.ini
16
tox.ini
@ -1,18 +1,22 @@
|
|||||||
# Tox (http://tox.testrun.org/) is a tool for running tests
|
# Tox (http://tox.testrun.org/) is a tool for running tests
|
||||||
# in multiple virtualenvs.
|
# in multiple virtualenvs. See ./CONTRIBUTING.rst
|
||||||
# Run:
|
|
||||||
# $ pip install -r requirements-dev.txt
|
|
||||||
# $ tox
|
|
||||||
|
|
||||||
|
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py26, py27, py34, pypy
|
envlist = py26, py27, py35, pypy
|
||||||
|
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
|
mock
|
||||||
pytest
|
pytest
|
||||||
pytest-httpbin>=0.0.6
|
pytest-httpbin>=0.0.6
|
||||||
|
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
py.test --verbose --doctest-modules --basetemp={envtmpdir} {posargs:./tests ./httpie}
|
# NOTE: the order of the directories in posargs seems to matter.
|
||||||
|
# When changed, then many ImportMismatchError exceptions occurrs.
|
||||||
|
py.test \
|
||||||
|
--verbose \
|
||||||
|
--doctest-modules \
|
||||||
|
{posargs:./httpie ./tests}
|
||||||
|
Loading…
Reference in New Issue
Block a user