Skip to content

Support the importlib.resources files API in rewritten files #9173

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

Merged
merged 4 commits into from
Oct 9, 2021
Merged

Support the importlib.resources files API in rewritten files #9173

merged 4 commits into from
Oct 9, 2021

Conversation

gaborbernat
Copy link
Contributor

@gaborbernat gaborbernat commented Oct 7, 2021

Resolves #9169

Verified

This commit was signed with the committer’s verified signature.
gaborbernat Bernát Gábor
Signed-off-by: Bernát Gábor <[email protected]>
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

seems reasonable 👍

Verified

This commit was signed with the committer’s verified signature.
gaborbernat Bernát Gábor
Signed-off-by: Bernát Gábor <[email protected]>
@gaborbernat gaborbernat marked this pull request as ready for review October 7, 2021 23:22
@gaborbernat gaborbernat changed the title Support the importlib.resources files API on rewritten Support the importlib.resources files API on rewritten files Oct 7, 2021
@gaborbernat gaborbernat changed the title Support the importlib.resources files API on rewritten files Support the importlib.resources files API in rewritten files Oct 7, 2021

Verified

This commit was signed with the committer’s verified signature.
gaborbernat Bernát Gábor
Signed-off-by: Bernát Gábor <[email protected]>
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

Verified

This commit was signed with the committer’s verified signature.
gaborbernat Bernát Gábor
Signed-off-by: Bernát Gábor <[email protected]>
@RonnyPfannschmidt
Copy link
Member

I believe this may also fix #9174

@nicoddemus
Copy link
Member

Thanks @gaborbernat!

@nicoddemus nicoddemus merged commit 3407fe6 into pytest-dev:main Oct 9, 2021
@@ -276,6 +276,14 @@ def get_data(self, pathname: Union[str, bytes]) -> bytes:
with open(pathname, "rb") as f:
return f.read()

if sys.version_info >= (3, 9):
Copy link
Contributor

Choose a reason for hiding this comment

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

Users of Python 3.8 and earlier can also get the files support by using importlib_resources backport. Are you okay with this functionality not being supported in those environments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm personally fine with that 😊

@gaborbernat gaborbernat deleted the rewrite branch October 10, 2021 21:55
hoefling pushed a commit to hoefling/pytest that referenced this pull request Oct 22, 2021

Partially verified

This commit is signed with the committer’s verified signature.
hoefling’s contribution has been verified via GPG key.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
@pllim
Copy link
Contributor

pllim commented Feb 1, 2022

Hello. Is there a release timeline including this fix? Thanks!

@asottile
Copy link
Member

asottile commented Feb 1, 2022

you can try it out in 7.0.0rc1 -- it will eventually land in 7.0 proper

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

Successfully merging this pull request may close these issues.

AssertionRewritingHook should support get_resource_reader
6 participants