From 33a2a3f17e77dd19efd4296b003a1d55e0d0cddd Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Fri, 15 Nov 2024 15:44:42 +0100 Subject: [PATCH] pkg_resources is deprecated in favor of importlib.resources --- mayavi/tests/test_preferences_mirror.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mayavi/tests/test_preferences_mirror.py b/mayavi/tests/test_preferences_mirror.py index 1027d43ea..71b86797e 100644 --- a/mayavi/tests/test_preferences_mirror.py +++ b/mayavi/tests/test_preferences_mirror.py @@ -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 @@ -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