mirror of
https://github.com/httpie/cli.git
synced 2024-12-25 07:49:17 +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
|
||||
######################
|
||||
|
||||
Bug reports and code and documentation patches are greatly appreciated. You can
|
||||
also help by using the development version of HTTPie and reporting any bugs you
|
||||
might encounter.
|
||||
Bug reports and code and documentation patches are welcome. You can
|
||||
help this project also by using the development version of HTTPie
|
||||
and by reporting any bugs you might encounter.
|
||||
|
||||
Bug Reports
|
||||
===========
|
||||
1. Reporting bugs
|
||||
=================
|
||||
|
||||
**It's important that you provide the full command argument list
|
||||
as well as the output of the failing command.**
|
||||
@ -15,12 +16,12 @@ to your bug report, e.g.:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ http --debug [arguments that trigger the error]
|
||||
[complete output]
|
||||
$ http --debug [COMPLETE ARGUMENT LIST THAT TRIGGERS THE ERROR]
|
||||
[COMPLETE OUTPUT]
|
||||
|
||||
|
||||
Contributing Code and Documentation
|
||||
===================================
|
||||
2. Contributing Code and Docs
|
||||
=============================
|
||||
|
||||
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
|
||||
@ -28,8 +29,11 @@ is a bigger one, it's always good to discuss before your starting working on
|
||||
it.
|
||||
|
||||
|
||||
Development Environment
|
||||
-----------------------
|
||||
Creating Development Environment
|
||||
--------------------------------
|
||||
|
||||
Go to https://github.com/jkbrzt/httpie and fork the project repository.
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@ -52,44 +56,56 @@ Making Changes
|
||||
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
|
||||
in all of the `supported Python environments`_. You should also **add tests
|
||||
for any new features and bug fixes**.
|
||||
in all of the `supported Python environments`_. You should also add tests
|
||||
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
|
||||
|
||||
### Running all tests:
|
||||
|
||||
# Current Python
|
||||
# Run all tests on the current Python interpreter
|
||||
make test
|
||||
|
||||
# Current Python with coverage
|
||||
# Run all tests on the current Python with coverage
|
||||
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
|
||||
|
||||
### Running specific tests:
|
||||
|
||||
# Current Python
|
||||
pytest tests/test_uploads.py
|
||||
Running specific tests:
|
||||
***********************
|
||||
|
||||
# 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::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
|
||||
.. _supported Python environments: https://github.com/jkbrzt/httpie/blob/master/tox.ini
|
||||
.. _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/
|
||||
.. _Style Guide for Python Code: http://python.org/dev/peps/pep-0008/
|
||||
.. _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)
|
||||
REQUIREMENTS="requirements-dev.txt"
|
||||
TAG="\n\n\033[0;32m\#\#\# "
|
||||
@ -7,6 +11,8 @@ all: test
|
||||
|
||||
uninstall-httpie:
|
||||
@echo $(TAG)Removing existing installation of HTTPie$(END)
|
||||
@echo "(NOTE: uninstall httpie manually if this fails)"
|
||||
@echo
|
||||
- pip uninstall --yes httpie >/dev/null
|
||||
! which http
|
||||
@echo
|
||||
@ -22,7 +28,7 @@ init: uninstall-httpie
|
||||
@echo
|
||||
|
||||
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
|
||||
@echo
|
||||
|
||||
|
@ -6,11 +6,11 @@ from httpie import __version__
|
||||
from httpie.compat import is_windows
|
||||
|
||||
|
||||
DEFAULT_CONFIG_DIR = os.environ.get(
|
||||
DEFAULT_CONFIG_DIR = str(os.environ.get(
|
||||
'HTTPIE_CONFIG_DIR',
|
||||
os.path.expanduser('~/.httpie') if not is_windows else
|
||||
os.path.expandvars(r'%APPDATA%\\httpie')
|
||||
)
|
||||
))
|
||||
|
||||
|
||||
class BaseConfigDict(dict):
|
||||
|
@ -53,7 +53,7 @@ class TestEnvironment(Environment):
|
||||
stdout_isatty = True
|
||||
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):
|
||||
|
||||
@ -72,7 +72,7 @@ class TestEnvironment(Environment):
|
||||
|
||||
def __del__(self):
|
||||
if self.delete_config_dir:
|
||||
self._shutil.rmtree(self.config_dir)
|
||||
self._shutil_rmtree(self.config_dir)
|
||||
|
||||
|
||||
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
|
||||
# in multiple virtualenvs.
|
||||
# Run:
|
||||
# $ pip install -r requirements-dev.txt
|
||||
# $ tox
|
||||
# in multiple virtualenvs. See ./CONTRIBUTING.rst
|
||||
|
||||
|
||||
[tox]
|
||||
envlist = py26, py27, py34, pypy
|
||||
envlist = py26, py27, py35, pypy
|
||||
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
mock
|
||||
pytest
|
||||
pytest-httpbin>=0.0.6
|
||||
|
||||
|
||||
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