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

pkg_resources is deprecated in favor of importlib.resources #1322

Merged
merged 1 commit into from
Dec 20, 2024
Merged
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
7 changes: 3 additions & 4 deletions mayavi/tests/test_preferences_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License: BSD Style.

import unittest
from pkg_resources import resource_filename
from importlib.resources import files, as_file

from traits.api import Str, Int, Bool
from apptools.preferences.api import set_default_preferences
Expand All @@ -25,9 +25,8 @@ def setUp(self):
"""Called before each test is run"""
self.preferences = set_default_preferences(Preferences())
# The filename of the example preferences file.
pref_file = resource_filename('mayavi.tests',
'test_preference.ini')
self.preferences.load(pref_file)
with as_file(files('mayavi.tests')/'test_preference.ini') as pref_file:
self.preferences.load(str(pref_file))
self.pref = _TestPreference()
self.mirror = PreferencesMirror()
self.mirror.preferences = self.pref
Expand Down
Loading