vcrpy icon indicating copy to clipboard operation
vcrpy copied to clipboard

Add Twisted support

Open nomasprime opened this issue 5 years ago • 0 comments
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).

nomasprime avatar Jun 25 '20 18:06 nomasprime