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

Path snapshotting support #829

Open
noirbizarre opened this issue Oct 27, 2023 · 3 comments
Open

Path snapshotting support #829

noirbizarre opened this issue Oct 27, 2023 · 3 comments
Labels
feature request New feature or request good first issue Good for newcomers waiting for feedback

Comments

@noirbizarre
Copy link

noirbizarre commented Oct 27, 2023

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

I would love to be able to make path snapshots and being able to write:

def test_something(snapshot):
	path: Path = do_something()
    assert path == snapshot

Would you be open to a pull request bringing this feature ? Because I have one which is working just fine, covered in test...

This includes:

  • both file and directory support
  • support both filtering and matching
  • proper diff with syntax highlighting using the same pattern as pytest (aka. support pygments as optional, so failsafe if it is not present)

Here's a sample syntax highlighted output:

Snapshot diff with syntax highlight

Describe the solution you'd like

Describe alternatives you've considered

Alternative: publish it separately, like an extension to the extension, something like syrupy-path. But I thought directory/file snapshotting is so common that it would make more sense to have this in syrupy

Additional context

Sorry to present it like that. In fact, I crafted my PR and then when rereading the contribution guide, I noticed this paragraph so here I am.

@noahnu noahnu added the feature request New feature or request label Nov 1, 2023
@noahnu
Copy link
Collaborator

noahnu commented Nov 1, 2023

Adding improved support for Path would be welcome! Feel free to open a pull request if you already have a proposed change.

@noahnu
Copy link
Collaborator

noahnu commented Feb 17, 2025

@noirbizarre Is this something you're still interested in? If so, contributions are welcome

@noirbizarre
Copy link
Author

Yes, it is.
Actually, I have an (unpublished) yet repository with it, but I faced some difficulties as all types, all mechanics (especially snapshot discovery) are meant for a single file, and breaks with a directory.
I'll publish as soon as possible to discuss what would be possible, what should be done, and whether it still belongs here or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request good first issue Good for newcomers waiting for feedback
Projects
Status: No status
Development

No branches or pull requests

2 participants