vcrpy doesn't work under django?
See original GitHub issueI’m trying to use vcrpy to accelerate the execution of my django application test suite. I’m using django 1.7 on Mac, with Python 2.7.
I added the following couple of lines to one of my tests:
import vcr
with vcr.use_cassette('recording.yaml'):
The result is an import error:
import vcr
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcr/__init__.py", line 2, in <module>
from .config import VCR
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcr/config.py", line 6, in <module>
from .cassette import Cassette
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcr/cassette.py", line 12, in <module>
from .patch import CassettePatcherBuilder
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcr/patch.py", line 8, in <module>
from .stubs import VCRHTTPConnection, VCRHTTPSConnection
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcr/stubs/__init__.py", line 9, in <module>
from six.moves.http_client import (
ImportError: No module named http_client
The problematic code in stubs/init.py is :
import six
from six.moves.http_client import (
HTTPConnection,
HTTPSConnection,
HTTPMessage,
HTTPResponse,
)
This code seems to run fine when I’m just running it from a plain python console, but it results in the above ImportError under django.
Issue Analytics
- State:
- Created 9 years ago
- Comments:34 (5 by maintainers)
Top Results From Across the Web
Advanced Features — vcrpy 4.2.1 documentation
Advanced Features¶. If you want, VCR.py can return information about the cassette it is using to record your requests and responses.
Read more >vcrpy record cassettes doesn't record in a test using test_client ...
But when I run the test the cassette was not generated. The thing is that if I change client.post by requests.post the response...
Read more >Lessons learned building with Django, Celery, and Pytest
As someone who writes ruby professionally, I recently learned python to build a bot which buys an index of crypto using binance.
Read more >How Hypothesis and VCR Changed the Way I Do Testing in ...
Jethro Muller is a software developer at Flickswitch. He primarily works in Python with Django on server-side code. He enjoys ORM query ...
Read more >Testing Django on Steroids with Pytest - Mad Devs
You do not waste your time to run manual tests;; Design of your code becomes better;; You prove with a working test that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing bc no one seems to have this issue anymore.
FWIW, I’m using vcrpy 1.10.2 to help in testing an application built with Django 1.9.6 and Django Rest Framework 3.3.3 with no issues.