A Pytest plugin to record Scrapy responses and use them as testing fixtures.
Project description
A Pytest plugin to record Scrapy responses and use them as testing fixtures. The motivation here is to decrease the friction to write unit tests for Scrapy spiders.
Install
pip install scrapy-mock
Usage
@pytest.mark.parametrize( ["url", "expected"], ("http://foobar.com/item/1", {"name": "item1", "url": "/item/1"}), ]) def test_parse(spider, response, expected): result = next(spider.parse(response)) assert result == expected
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scrapy-mock-0.1.0.tar.gz
(3.1 kB
view details)
File details
Details for the file scrapy-mock-0.1.0.tar.gz
.
File metadata
- Download URL: scrapy-mock-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc87e6e026d0a6eabc0458ec7c23134701b4f3b525f57ffbbc877d56c053fd45 |
|
MD5 | 6559d1b6fd712b0321d02cabba41c7a1 |
|
BLAKE2b-256 | 01271b13bdb511f45945a1ff0ff37abe41669b6045ad1624f7683251294c168b |