-
Notifications
You must be signed in to change notification settings - Fork 27
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
Stop using pkg_resources #158
Conversation
|
||
def vector_path(*names: str) -> str: | ||
"""Path to a test vector.""" | ||
return pkg_resources.resource_filename( | ||
__name__, os.path.join('testdata', *names)) | ||
file_manager = contextlib.ExitStack() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have an explanatory comment here.
For me, it was not obvious that as_file
might generate temporary files on disk that need to be cleaned up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's totally reasonable. I linked to the migration guide I based this code on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
When working on #157, I got errors because the new version of
setuptools
deprecatespkg_resources
. To fix that, I used the "Attention" message at the top of https://setuptools.pypa.io/en/latest/pkg_resources.html and https://importlib-resources.readthedocs.io/en/latest/index.html. Importingtestdata
as a package like this after adding__init__.py
Just Works™ for the same reasonimport test_util
works.