Skip to content

Commit a7555f6

Browse files
committed
Apply changes from importlib_resources 5.0.4
1 parent 18eab96 commit a7555f6

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Lib/test/test_importlib/test_reader.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os.path
22
import sys
3+
import pathlib
34
import unittest
45

56
from importlib import import_module
@@ -9,7 +10,8 @@
910
class MultiplexedPathTest(unittest.TestCase):
1011
@classmethod
1112
def setUpClass(cls):
12-
cls.folder = os.path.abspath(os.path.join(__file__, '..', 'namespacedata01'))
13+
path = pathlib.Path(__file__).parent / 'namespacedata01'
14+
cls.folder = str(path)
1315

1416
def test_init_no_paths(self):
1517
with self.assertRaises(FileNotFoundError):
@@ -83,9 +85,15 @@ def test_repr(self):
8385

8486

8587
class NamespaceReaderTest(unittest.TestCase):
88+
site_dir = str(pathlib.Path(__file__).parent)
89+
8690
@classmethod
8791
def setUpClass(cls):
88-
sys.path.append(os.path.abspath(os.path.join(__file__, '..')))
92+
sys.path.append(cls.site_dir)
93+
94+
@classmethod
95+
def tearDownClass(cls):
96+
sys.path.remove(cls.site_dir)
8997

9098
def test_init_error(self):
9199
with self.assertRaises(ValueError):

Lib/test/test_importlib/test_resource.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os.path
21
import sys
32
import unittest
43
import uuid
@@ -216,9 +215,15 @@ def test_read_text_does_not_keep_open(self):
216215

217216

218217
class ResourceFromNamespaceTest01(unittest.TestCase):
218+
site_dir = str(pathlib.Path(__file__).parent)
219+
219220
@classmethod
220221
def setUpClass(cls):
221-
sys.path.append(os.path.abspath(os.path.join(__file__, '..')))
222+
sys.path.append(cls.site_dir)
223+
224+
@classmethod
225+
def tearDownClass(cls):
226+
sys.path.remove(cls.site_dir)
222227

223228
def test_is_submodule_resource(self):
224229
self.assertTrue(

0 commit comments

Comments
 (0)