(self)
| 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 | |
| 564 | class NestedNamespacePackageTest(unittest.TestCase): |
nothing calls this directly
no test coverage detected