def testNoPackageAtAll(self): module = self.CreateModule('__main__') self.assertPackageEquals('__main__', util.get_package_for_module(module))
def testNoExtension(self): module = self.CreateModule('__main__') module.__file__ = '/bing/blam/bloom/blarm/my_file' self.assertPackageEquals('my_file', util.get_package_for_module(module))
def testIsMainCompiled(self): module = self.CreateModule('__main__') module.__file__ = '/bing/blam/bloom/blarm/my_file.pyc' self.assertPackageEquals('my_file', util.get_package_for_module(module))
def testHasModuleName(self): module = self.CreateModule('service_module') self.assertPackageEquals('service_module', util.get_package_for_module(module))
def testHasPackage(self): module = self.CreateModule('service_module') module.package = 'my_package' self.assertPackageEquals('my_package', util.get_package_for_module(module))
def testModuleNameNotInSys(self): self.assertPackageEquals(None, util.get_package_for_module('service_module'))