Skip to main content

scrapy-mock

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

Metadata

Release files for scrapy-mock 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrapy-mock 0.1.0
File Size Uploaded Provenance Actions
scrapy-mock-0.1.0.tar.gz 3.1 kB Without provenance Details for scrapy-mock-0.1.0.tar.gz

Release files / scrapy-mock-0.1.0.tar.gz

Download URL scrapy-mock-0.1.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cc87e6e026d0a6eabc0458ec7c23134701b4f3b525f57ffbbc877d56c053fd45
BLAKE2b-256 checksum
How to use checksums
01271b13bdb511f45945a1ff0ff37abe41669b6045ad1624f7683251294c168b
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for scrapy-mock 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page