vcrpy
vcrpy copied to clipboard
Add Twisted support
trafficstars
For a learning project I'm writing a web scraper with tests. In the following example it works as expected with the commented out line but requests inside the CrawlerProcess/Twisted Reactor aren't being picked up.
@pytest.mark.vcr
def test_parse(self):
# assert requests.get("http://httpbin.org/ip").text == '{"ip": true}'
BaseSpider.start_urls = ['thoughtbot']
BaseSpider.custom_settings = {
'ROBOTSTEXT_OBEY': False
}
process = CrawlerProcess()
process.crawl(BaseSpider)
process.start()
Turns out VCRpy doesn't support Twisted (see https://github.com/kiwicom/pytest-recording/issues/50).