Skip to content

Commit

Permalink
pkg_resources is deprecated in favor of importlib.resources
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Dec 17, 2024
1 parent 40c6010 commit 614b5ab
Showing 1 changed file with 3 additions and 4 deletions.
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

0 comments on commit 614b5ab

Please sign in to comment.