MCPcopy Index your code
hub / github.com/python/cpython / test_extend_path_pkg_files

Method test_extend_path_pkg_files

Lib/test/test_pkgutil.py:541–561  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

539
540
541 def test_extend_path_pkg_files(self):
542 pkgname = 'foo'
543 dirname_0 = self.create_init(pkgname)
544
545 with open(os.path.join(dirname_0, 'bar.pkg'), 'w') as pkg_file:
546 pkg_file.write('\n'.join([
547 'baz',
548 '/foo/bar/baz',
549 '',
550 '#comment'
551 ]))
552
553 extended_paths = pkgutil.extend_path(sys.path, 'bar')
554
555 self.assertEqual(extended_paths[:-2], sys.path)
556 self.assertEqual(extended_paths[-2], 'baz')
557 self.assertEqual(extended_paths[-1], '/foo/bar/baz')
558
559 # Cleanup
560 shutil.rmtree(dirname_0)
561 del sys.path[0]
562
563
564class NestedNamespacePackageTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

create_initMethod · 0.95
openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected