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

Method test_nested

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

Source from the content-addressed store, hash-verified

580 f.write(contents)
581
582 def test_nested(self):
583 pkgutil_boilerplate = (
584 'import pkgutil; '
585 '__path__ = pkgutil.extend_path(__path__, __name__)')
586 self.create_module('a.pkg.__init__', pkgutil_boilerplate)
587 self.create_module('b.pkg.__init__', pkgutil_boilerplate)
588 self.create_module('a.pkg.subpkg.__init__', pkgutil_boilerplate)
589 self.create_module('b.pkg.subpkg.__init__', pkgutil_boilerplate)
590 self.create_module('a.pkg.subpkg.c', 'c = 1')
591 self.create_module('b.pkg.subpkg.d', 'd = 2')
592 sys.path.insert(0, os.path.join(self.basedir, 'a'))
593 sys.path.insert(0, os.path.join(self.basedir, 'b'))
594 import pkg
595 self.addCleanup(unload, 'pkg')
596 self.assertEqual(len(pkg.__path__), 2)
597 import pkg.subpkg
598 self.addCleanup(unload, 'pkg.subpkg')
599 self.assertEqual(len(pkg.subpkg.__path__), 2)
600 from pkg.subpkg.c import c
601 from pkg.subpkg.d import d
602 self.assertEqual(c, 1)
603 self.assertEqual(d, 2)
604
605
606class ImportlibMigrationTests(unittest.TestCase):

Callers

nothing calls this directly

Calls 6

create_moduleMethod · 0.95
lenFunction · 0.85
addCleanupMethod · 0.80
insertMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected