Contributing

Running VCR’s test suite

The tests are all run automatically on Travis CI, but you can also run them yourself using py.test and Tox. 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 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 :

__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:

export PYCURL_SSL_LIBRARY=openssl
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include

Reference : stackoverflow issue