Skip to content

Conversation

@dcamron
Copy link
Member

@dcamron dcamron commented Jul 9, 2025

We can interface with VCR.py through pytest-recording for flexible config in tests and in the Pytest CLI. The project is actively maintained edit though some lingering conda-forge PRs need addressed edit. In doing so we can:

  • Toggle VCR record mode to none in CI via pytest flag. This disallows updating existing cassettes with new requests and recording new cassettes if they don't exist, eg test is added and decorated without checking in a cassette from local
  • Can eliminate needs_aws to rely on our existing functionality more explicitly and generally
  • Can config VCR.py, add extra cassettes, etc. in pytest scopes (per-function decorator, per-module config, etc.) And config inherits and overwrites predictably.

I also tried configuring VCR to fail to write new cassettes on exceptions in tests, but the behavior wasn't what I expected.

There are other reasonable ways to configure this, and I don't think we have to take on this pytest-recording dep. Still, I got sniped and wanted to open a PR to show it for discussion. We can get most of this with VCR.py config directly. I have also yet to reimplement the behavior to skip tests if no VCR - tougher with a pytest plugin.

If we do move forward I will take this opportunity to update the dev guide with instructions.

  • Fully documented

Interface with VCR.py through pytest-recording for flexible config per-test/per-file and via Pytest CLI. Update CI to fail on new requests or missing cassettes. Dismantle needs_aws: generalize cassette dirs in conftest.py, filter appropriate warnings visibly in test_aws.py, and separately use needs_module and/or vcr mark as needed.
@dcamron dcamron requested a review from a team as a code owner July 9, 2025 15:38
@dcamron dcamron requested review from dopplershift and removed request for a team July 9, 2025 15:38
@dcamron dcamron added Area: Infrastructure Pertains to project infrastructure (e.g. CI, linting) Type: Maintenance Updates and clean ups (but not wrong) Area: Docs Affects documentation Area: Tests Affects tests Area: Remote Pertains to remote data clients labels Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Docs Affects documentation Area: Infrastructure Pertains to project infrastructure (e.g. CI, linting) Area: Remote Pertains to remote data clients Area: Tests Affects tests Type: Maintenance Updates and clean ups (but not wrong)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant