Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
backports.zoneinfo==0.2.1;python_version<"3.9"
coverage==7.6.1
dirty-equals==0.8.0
inline-snapshot==0.13.3
inline-snapshot==0.13.3 ; implementation_name == "cpython"
hypothesis==6.111.2
# pandas doesn't offer prebuilt wheels for all versions and platforms we test in CI e.g. aarch64 musllinux
pandas==2.1.3; python_version >= "3.9" and python_version < "3.13" and implementation_name == "cpython" and platform_machine == 'x86_64'
Expand Down
9 changes: 9 additions & 0 deletions tests/snapshot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import sys

if sys.implementation.name == 'cpython':
from inline_snapshot import snapshot
else:
Comment on lines +3 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to:

Suggested change
if sys.implementation.name == 'cpython':
from inline_snapshot import snapshot
else:
try:
from inline_snapshot import snapshot
except ImportError:

? I mean, I've packaged inline-snapshot for Gentoo CPython already, but I suppose it may save others trouble for the time being.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got an idea. maybe we don't need this fix at all.
I can force inline-snapshot to run with --inline-snapshot=disable if something other then cpython is used. This would allow me to enable inline-snapshot again when I support it.

This would mean for you to package a inline-snapshot version for pypy which will not be able to create snapshots ... until I support it.

I think this would be better than to add a fix like this into every package which uses inline-snapshot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure — but could you make it possible to run a subset of inline-snapshot's test suite that covers the available functionality on PyPy then?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I will write some extra tests. But the disable logic is already tested.

# inline-snapshot has currently no pypy support.
# This fallback allows snapshots to be used during pypy tests.
def snapshot(value):
return value
3 changes: 2 additions & 1 deletion tests/validators/test_allow_partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import pytest
from dirty_equals import IsStrictDict
from inline_snapshot import snapshot

from pydantic_core import SchemaValidator, ValidationError, core_schema

from ..snapshot import snapshot


def test_list():
v = SchemaValidator(
Expand Down