예제 #1
0
파일: test_exocet.py 프로젝트: reuben/bravo
 def test_loadWithLocalImports(self):
     """
     Execution of local imports are resolved in the context the
     containing module was originally loaded in.
     """
     pc = loadPackageNamed("exocet.test.testpackage_localimports", emptyMapper)
     foo = pc.loadNamed("exocet.test.testpackage_localimports.foo")
     util = pc.loadNamed("exocet.test.testpackage_localimports.util")
     self.assertEqual(foo.fooName, [])
     util2 = foo.do()
     self.assertEqual(foo.fooName[0], util.utilName)
     assertIdentical(self, util2, util)
예제 #2
0
 def test_loadWithLocalImports(self):
     """
     Execution of local imports are resolved in the context the
     containing module was originally loaded in.
     """
     pc = loadPackageNamed("exocet.test.testpackage_localimports", emptyMapper)
     foo = pc.loadNamed("exocet.test.testpackage_localimports.foo")
     util = pc.loadNamed("exocet.test.testpackage_localimports.util")
     self.assertEqual(foo.fooName, [])
     util2 = foo.do()
     self.assertEqual(foo.fooName[0], util.utilName)
     assertIdentical(self, util2, util)
예제 #3
0
파일: test_exocet.py 프로젝트: reuben/bravo
    def test_loadCircularPackage(self):
        """
        Packages with circular imports can be loaded correctly by C{loadPackageNamed}.
        """

        pc = loadPackageNamed("exocet.test.testpackage", emptyMapper)
        top = pc.loadNamed("exocet.test.testpackage.topmodule")
        foo = pc.loadNamed("exocet.test.testpackage.foo")
        baz = pc.loadNamed("exocet.test.testpackage.baz")
        util = pc.loadNamed("exocet.test.testpackage.util")
        assertIdentical(self, top.foo, foo)
        assertIdentical(self, top.baz, baz)
        assertIdentical(self, foo.util, baz.util)
예제 #4
0
    def test_loadCircularPackage(self):
        """
        Packages with circular imports can be loaded correctly by C{loadPackageNamed}.
        """

        pc = loadPackageNamed("exocet.test.testpackage", emptyMapper)
        top = pc.loadNamed("exocet.test.testpackage.topmodule")
        foo = pc.loadNamed("exocet.test.testpackage.foo")
        baz = pc.loadNamed("exocet.test.testpackage.baz")
        util = pc.loadNamed("exocet.test.testpackage.util")
        assertIdentical(self, top.foo, foo)
        assertIdentical(self, top.baz, baz)
        assertIdentical(self, foo.util, baz.util)
예제 #5
0
파일: test_exocet.py 프로젝트: reuben/bravo
 def test_loadPackageNamed(self):
     """
     Calling C{loadPackageNamed} returns a package context from which
     modules with shared state and knowledge of other code in the
     package can be loaded.
     """
     pc = loadPackageNamed("exocet.test.testpackage", emptyMapper)
     top = pc.loadNamed("exocet.test.testpackage.topmodule")
     foo = pc.loadNamed("exocet.test.testpackage.foo")
     baz = pc.loadNamed("exocet.test.testpackage.baz")
     util = pc.loadNamed("exocet.test.testpackage.util")
     assertIdentical(self, top.foo, foo)
     assertIdentical(self, top.baz, baz)
     assertIdentical(self, foo.util, baz.util)
예제 #6
0
 def test_loadPackageNamed(self):
     """
     Calling C{loadPackageNamed} returns a package context from which
     modules with shared state and knowledge of other code in the
     package can be loaded.
     """
     pc = loadPackageNamed("exocet.test.testpackage", emptyMapper)
     top = pc.loadNamed("exocet.test.testpackage.topmodule")
     foo = pc.loadNamed("exocet.test.testpackage.foo")
     baz = pc.loadNamed("exocet.test.testpackage.baz")
     util = pc.loadNamed("exocet.test.testpackage.util")
     assertIdentical(self, top.foo, foo)
     assertIdentical(self, top.baz, baz)
     assertIdentical(self, foo.util, baz.util)