File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 11import os .path
22import sys
3+ import pathlib
34import unittest
45
56from importlib import import_module
910class 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
8587class 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 ):
Original file line number Diff line number Diff line change 1- import os .path
21import sys
32import unittest
43import uuid
@@ -216,9 +215,15 @@ def test_read_text_does_not_keep_open(self):
216215
217216
218217class 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 (
You can’t perform that action at this time.
0 commit comments