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

Method test_mixed_namespace

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

Source from the content-addressed store, hash-verified

496
497
498 def test_mixed_namespace(self):
499 pkgname = 'foo'
500 dirname_0 = self.create_init(pkgname)
501 dirname_1 = self.create_init(pkgname)
502 self.create_submodule(dirname_0, pkgname, 'bar', 0)
503 # Turn this into a PEP 420 namespace package
504 os.unlink(os.path.join(dirname_0, pkgname, '__init__.py'))
505 self.create_submodule(dirname_1, pkgname, 'baz', 1)
506 import foo.bar
507 import foo.baz
508 # Ensure we read the expected values
509 self.assertEqual(foo.bar.value, 0)
510 self.assertEqual(foo.baz.value, 1)
511
512 # Ensure the path is set up correctly
513 self.assertEqual(sorted(foo.__path__),
514 sorted([os.path.join(dirname_0, pkgname),
515 os.path.join(dirname_1, pkgname)]))
516
517 # Cleanup
518 shutil.rmtree(dirname_0)
519 shutil.rmtree(dirname_1)
520 del sys.path[0]
521 del sys.path[0]
522 del sys.modules['foo']
523 del sys.modules['foo.bar']
524 del sys.modules['foo.baz']
525
526
527 def test_extend_path_argument_types(self):

Callers

nothing calls this directly

Calls 6

create_initMethod · 0.95
create_submoduleMethod · 0.95
sortedFunction · 0.85
unlinkMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected