MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_extend_path_pkg_files

Method test_extend_path_pkg_files

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

Source from the content-addressed store, hash-verified

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