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

JSONSnapshotExtension will not work with Python 3.7 #585

Closed
dtczest opened this issue Jan 25, 2022 · 4 comments · Fixed by #586
Closed

JSONSnapshotExtension will not work with Python 3.7 #585

dtczest opened this issue Jan 25, 2022 · 4 comments · Fixed by #586
Labels

Comments

@dtczest
Copy link
Contributor

dtczest commented Jan 25, 2022

Describe the bug

JSONSnapshotExtension will not work with Python 3.7.
syrupy/extensions/json/__init__.py imports SerializableData from syrupy.types ONLY if TYPE_CHECKING is True. In Python 3.7, TYPE_CHECKING is false. Trying to use JSONSnapshotExtension in Python 3.7 will result in a runtime error upon import:
NameError: name 'SerializableData' is not defined

To reproduce

Steps to reproduce the behavior:
In a Python 3.7 environment, try to import from syrupy.extensions.json import JSONSnapshotExtension
You will see error:
NameError: name 'SerializableData' is not defined

Expected behavior

The code should handle this scenario

Environment (please complete the following information):

  • OS: Mac OSX
  • Syrupy Version: 1.7.0
  • Python Version: 3.7.7
@dtczest
Copy link
Contributor Author

dtczest commented Jan 25, 2022

Thanks!

@tophat-opensource-bot
Copy link
Contributor

🎉 This issue has been resolved in version 1.7.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@dtczest
Copy link
Contributor Author

dtczest commented Jan 25, 2022

So I tried this with 1.7.2, and now it's also happening with 'PropertyPath' (line 57). I assume it'll happen with PropertyMatcher too (line 59). All the rest looks good. @noahnu

Edit: yes, fixing those 2 lines makes it work for me.

@dtczest
Copy link
Contributor Author

dtczest commented Jan 25, 2022

Opened #587

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

Successfully merging a pull request may close this issue.

2 participants