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