Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to detect unused cassettes #163

Open
jamesbraza opened this issue Jan 20, 2025 · 1 comment
Open

Ability to detect unused cassettes #163

jamesbraza opened this issue Jan 20, 2025 · 1 comment

Comments

@jamesbraza
Copy link

Is your feature request related to a problem? Please describe.

I have observed people delete tests during a refactor, but forget to remove the accompanying VCR cassettes.

What happens is unused cassettes slowly build-up in the repo, resulting in misleading grep results and wasted ROM.

Currently the way I detect unused cassettes is by:

  1. Using Git
  2. Deleting all cassettes
  3. Running all unit tests to regenerate cassettes (e.g. pytest --record-mode=once)
  4. Using git status to look if any outstanding changes exist beyond file modifications

Describe the solution you'd like

pytest-recording to have some option to detect unused cassettes, when running pytest on the full repo.

Describe alternatives you've considered

None considered.

Additional context

n/a

@jamesbraza jamesbraza changed the title Ability to flag unused cassettes Ability to detect unused cassettes Jan 20, 2025
@Stranger6667
Copy link
Collaborator

That would be useful! I think some inspiration for implementing this can come from https://github.com/syrupy-project/syrupy

It deletes unused snapshots during testing, which looks like exactly what is needed here.

Right now I don’t have a bandwidth to work on it, but will be happy to review a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants