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

Method test_simple

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

Source from the content-addressed store, hash-verified

419 print('value={}'.format(value), file=fl)
420
421 def test_simple(self):
422 pkgname = 'foo'
423 dirname_0 = self.create_init(pkgname)
424 dirname_1 = self.create_init(pkgname)
425 self.create_submodule(dirname_0, pkgname, 'bar', 0)
426 self.create_submodule(dirname_1, pkgname, 'baz', 1)
427 import foo.bar
428 import foo.baz
429 # Ensure we read the expected values
430 self.assertEqual(foo.bar.value, 0)
431 self.assertEqual(foo.baz.value, 1)
432
433 # Ensure the path is set up correctly
434 self.assertEqual(sorted(foo.__path__),
435 sorted([os.path.join(dirname_0, pkgname),
436 os.path.join(dirname_1, pkgname)]))
437
438 # Cleanup
439 shutil.rmtree(dirname_0)
440 shutil.rmtree(dirname_1)
441 del sys.path[0]
442 del sys.path[0]
443 del sys.modules['foo']
444 del sys.modules['foo.bar']
445 del sys.modules['foo.baz']
446
447
448 # Another awful testing hack to be cleaned up once the test_runpy

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected