mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
* Add travis testing support for python 3.8 * Use Xenial for all * Simplify matrix * Consistent indents * Add py38 to tox and update contributing guide for how to use pyenv * Fix travis spec to allow 3.8-dev to fail and tox should pass 90% coverage for full suite
82 lines
2.7 KiB
ReStructuredText
82 lines
2.7 KiB
ReStructuredText
Contributing
|
|
============
|
|
|
|
Running VCR's test suite
|
|
------------------------
|
|
|
|
The tests are all run automatically on `Travis
|
|
CI <https://travis-ci.org/kevin1024/vcrpy>`__, but you can also run them
|
|
yourself using `py.test <http://pytest.org/>`__ and
|
|
`Tox <http://tox.testrun.org/>`__. Tox will automatically run them in
|
|
all environments VCR.py supports. The test suite is pretty big and slow,
|
|
but you can tell tox to only run specific tests like this::
|
|
|
|
tox -e {pyNN}-{HTTP_LIBRARY} -- <pytest flags passed through>
|
|
|
|
tox -e py27-requests -- -v -k "'test_status_code or test_gzip'"
|
|
tox -e py37-requests -- -v --last-failed
|
|
|
|
This will run only tests that look like ``test_status_code`` or
|
|
``test_gzip`` in the test suite, and only in the python 2.7 environment
|
|
that has ``requests`` installed.
|
|
|
|
Also, in order for the boto tests to run, you will need an AWS key.
|
|
Refer to the `boto
|
|
documentation <https://boto.readthedocs.io/en/latest/getting_started.html>`__
|
|
for how to set this up. I have marked the boto tests as optional in
|
|
Travis so you don't have to worry about them failing if you submit a
|
|
pull request.
|
|
|
|
Using PyEnv with VCR's test suite
|
|
---------------------------------
|
|
|
|
PyEnv is a tool for managing multiple installation of python on your system.
|
|
See the full documentation at their `github <https://github.com/pyenv/pyenv>`
|
|
but we are also going to use `tox-pyenv <https://pypi.org/project/tox-pyenv/>`
|
|
in this example::
|
|
|
|
git clone https://github.com/pyenv/pyenv ~/.pyenv
|
|
|
|
# Add ~/.pyenv/bin to your PATH
|
|
export PATH="$PATH:~/.pyenv/bin"
|
|
|
|
# Setup shim paths
|
|
eval "$(pyenv init -)"
|
|
|
|
# Setup your local system tox tooling
|
|
pip install tox tox-pyenv
|
|
|
|
# Install supported versions (at time of writing), this does not activate them
|
|
pyenv install 2.7.10 3.5.7 3.6.9 3.7.4 3.8-dev pypy2.6-7.1.1 pypy3.6-7.1.1
|
|
|
|
# This activates them
|
|
pyenv local 2.7.10 3.5.7 3.6.9 3.7.4 3.8-dev pypy2.6-7.1.1 pypy3.6-7.1.1
|
|
|
|
# Run the whole test suite
|
|
tox
|
|
|
|
# Run the whole test suite or just part of it
|
|
tox -e lint
|
|
tox -e py37-requests
|
|
|
|
|
|
Troubleshooting on MacOSX
|
|
-------------------------
|
|
|
|
If you have this kind of error when running tox :
|
|
|
|
.. code:: python
|
|
|
|
__main__.ConfigurationError: Curl is configured to use SSL, but we have
|
|
not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.
|
|
|
|
Then you need to define some environment variables:
|
|
|
|
.. code:: bash
|
|
|
|
export PYCURL_SSL_LIBRARY=openssl
|
|
export LDFLAGS=-L/usr/local/opt/openssl/lib
|
|
export CPPFLAGS=-I/usr/local/opt/openssl/include
|
|
|
|
Reference : `stackoverflow issue <https://stackoverflow.com/questions/51019622/curl-is-configured-to-use-ssl-but-we-have-not-been-able-to-determine-which-ssl>`__
|