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

fix: NameError when importing SingleFileSnapshotExtension #557

Merged

Conversation

joakimnordling
Copy link
Contributor

Description

Fixes the following issue:

If you try to import SingleFileSnapshotExtension it will raise NameError: name 'SerializedData' is not defined because SerializedData is only imported if type checking and the return type annotation was not quoted.

Example:

>>> from syrupy.extensions.single_file import SingleFileSnapshotExtension
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jocke/projects/syrupy/src/syrupy/extensions/single_file.py", line 26, in <module>
    class SingleFileSnapshotExtension(AbstractSyrupyExtension):
  File "/Users/jocke/projects/syrupy/src/syrupy/extensions/single_file.py", line 33, in SingleFileSnapshotExtension
    ) -> SerializedData:
NameError: name 'SerializedData' is not defined

If you try  to import `SingleFileSnapshotExtension` it will raise `NameError: name 'SerializedData' is not defined` because SerializedData is only imported if type checking and the return type annotation was not quoted.

Example:
```
>>> from syrupy.extensions.single_file import SingleFileSnapshotExtension
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jocke/projects/syrupy/src/syrupy/extensions/single_file.py", line 26, in <module>
    class SingleFileSnapshotExtension(AbstractSyrupyExtension):
  File "/Users/jocke/projects/syrupy/src/syrupy/extensions/single_file.py", line 33, in SingleFileSnapshotExtension
    ) -> SerializedData:
NameError: name 'SerializedData' is not defined
```
@noahnu noahnu merged commit 935e256 into syrupy-project:master Oct 13, 2021
@noahnu
Copy link
Collaborator

noahnu commented Oct 13, 2021

@all-contributors add @joakimnordling for bug fix

@allcontributors
Copy link
Contributor

@noahnu

I've put up a pull request to add @joakimnordling! 🎉

@joakimnordling joakimnordling deleted the bugfix/fix-import-problem branch October 13, 2021 11:23
@noahnu
Copy link
Collaborator

noahnu commented Oct 13, 2021

Thank you for the fix! Unfortunately the CI pipeline seems to be broken: https://github.com/tophat/syrupy/runs/3881842927. Not sure what's happening as I published successfully a week ago. Maybe something changed in the github hosted runners. I'll take a look at some point today so hopefully we can get this released.

tophat-opensource-bot pushed a commit that referenced this pull request Oct 13, 2021
## [1.4.7](v1.4.6...v1.4.7) (2021-10-13)

### Bug Fixes

* NameError when importing SingleFileSnapshotExtension ([#557](#557)) ([935e256](935e256))
@tophat-opensource-bot
Copy link
Contributor

🎉 This PR is included in version 1.4.7 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@joakimnordling
Copy link
Contributor Author

Thank you for the fix! Unfortunately the CI pipeline seems to be broken: https://github.com/tophat/syrupy/runs/3881842927. Not sure what's happening as I published successfully a week ago. Maybe something changed in the github hosted runners. I'll take a look at some point today so hopefully we can get this released.

No problem and thanks for quickly incorporating the fix and getting it released! It allowed me to now get the latest version in use instead of pinning to 1.4.5.

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 this pull request may close these issues.

3 participants