skillfed

vcrpy-unittest

Python unittest integration for vcr.py

vcrpy-unittest v0.1.7 87.8K downloads/30d#13,765 on PyPI43
Permissive license MIT Abandoned released

What it is and what it does

vcrpy-unittest bridges vcrpy and Python's unittest framework by providing VCRTestCase, a base class that automatically handles HTTP cassette recording and playback. Instead of manually wrapping test methods with VCR context managers, you inherit from VCRTestCase and write normal unittest code; the class intercepts HTTP calls, records them to YAML files on first run, and replays them on subsequent runs. It also exposes the cassette object as self.cassette so you can make assertions about recorded interactions.

The package is lightweight—it depends only on vcrpy—and offers customization hooks (_get_vcr_kwargs, _get_cassette_library_dir, _get_cassette_name, _get_vcr) to control cassette location, naming, and VCR configuration. A VCRMixin variant is available for cases where inheriting from VCRTestCase conflicts with existing class hierarchies.

Use it for:

  • Write integration tests that record live HTTP interactions on first run, then replay recorded responses in CI/CD pipelines without network access.
  • Test code that depends on external APIs by recording interactions once, then running tests offline with deterministic responses.
  • Verify HTTP request details by inspecting self.cassette.requests and self.cassette after a test executes.
  • Add custom VCR matchers to control how recorded requests are matched during playback.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a unittest base class that automatically records and replays HTTP interactions using vcrpy, eliminating manual cassette management in test code.

No. The package is abandoned (last release 2018-09-25, repository archived) with no activity for over 2880 days. Compatibility with modern Python versions and current vcrpy releases is unverified. While the concept is sound and the MIT license is permissive, the lack of maintenance creates risk for new projects. Consider using vcrpy directly with unittest, or evaluate actively maintained alternatives.

Install

vcrpy-unittest on PyPI

pip

pip install vcrpy-unittest

uv

uv add vcrpy-unittest

poetry

poetry add vcrpy-unittest

Installing vcrpy-unittest

Before you install

Low install friction with a single runtime dependency on vcrpy. However, the package is abandoned—last release was 2018-09-25 and the repository was archived. No updates have been made in over 2880 days, so compatibility with modern Python or vcrpy versions is uncertain.

License in practice

MIT license is permissive and imposes no significant restrictions on use, modification, or distribution. Suitable for both open-source and proprietary projects.

Quickstart

pip install vcrpy-unittest

from vcr_unittest import VCRTestCase

class MyTestCase(VCRTestCase):
    def test_something(self):
        self.assertEqual(len(self.cassette), 1)

Requires vcrpy as a runtime dependency; cassettes are stored in a 'cassettes' subdirectory by default relative to the test file.

Verify before relying

  • Compatibility with current vcrpy versions and modern Python releases (last tested with Python 3.7)
  • Whether the package works with unittest features added after 2018
  • Active maintenance status or community forks that may have continued development

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — vcrpy
Maintenance abandoned — 2,880 days since the last release
Last repo commit (repository archived)
First released
Downloads 87,842/month — #13,765 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: vcrpy_unittest-0.1.7-py2.py3-none-any.whl

Keywords: vcrpy, vcr.py, unittest, testing, mock, http

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Topic :: Software Development :: Build Tools

Tags

unittest http mockingvcr.py integrationhttp cassette recordingtest http interactionshttp replay testingmock http requests testingvcr unittest base class
http-mockingtest-fixtures

More Build Tools packages