Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Apply changes from importlib_resources 5.0.4
  • Loading branch information
jaraco committed Mar 4, 2021
commit a7555f6d290d4541325a66246e0990a79a5d286f
12 changes: 10 additions & 2 deletions Lib/test/test_importlib/test_reader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os.path
import sys
import pathlib
import unittest

from importlib import import_module
Expand All @@ -9,7 +10,8 @@
class MultiplexedPathTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.folder = os.path.abspath(os.path.join(__file__, '..', 'namespacedata01'))
path = pathlib.Path(__file__).parent / 'namespacedata01'
cls.folder = str(path)

def test_init_no_paths(self):
with self.assertRaises(FileNotFoundError):
Expand Down Expand Up @@ -83,9 +85,15 @@ def test_repr(self):


class NamespaceReaderTest(unittest.TestCase):
site_dir = str(pathlib.Path(__file__).parent)

@classmethod
def setUpClass(cls):
sys.path.append(os.path.abspath(os.path.join(__file__, '..')))
sys.path.append(cls.site_dir)

@classmethod
def tearDownClass(cls):
sys.path.remove(cls.site_dir)

def test_init_error(self):
with self.assertRaises(ValueError):
Expand Down
9 changes: 7 additions & 2 deletions Lib/test/test_importlib/test_resource.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os.path
import sys
import unittest
import uuid
Expand Down Expand Up @@ -216,9 +215,15 @@ def test_read_text_does_not_keep_open(self):


class ResourceFromNamespaceTest01(unittest.TestCase):
site_dir = str(pathlib.Path(__file__).parent)

@classmethod
def setUpClass(cls):
sys.path.append(os.path.abspath(os.path.join(__file__, '..')))
sys.path.append(cls.site_dir)

@classmethod
def tearDownClass(cls):
sys.path.remove(cls.site_dir)

def test_is_submodule_resource(self):
self.assertTrue(
Expand Down