def testAbsolutePackageImport(self): """Test that the a/aa/__init__ module is found when the a/aa module is imported relatively from a file in that folder.""" self.buildTempDirs() expected = os.path.join(self.temp_fake_aa, "__init__") aaeggs = os.path.join(self.temp_fake_aa, "eggs.py") self.assertEqual(expected, modulefinder.get_module_filename("aa", aaeggs))
def testAbsolutePackageImport(self): """Test that the a/aa/__init__ module is found when the a/aa module is imported relatively from a file in that folder.""" self.buildTempDirs() expected = os.path.join(self.temp_fake_aa, '__init__') aaeggs = os.path.join(self.temp_fake_aa, 'eggs.py') self.assertEqual(expected, modulefinder.get_module_filename('aa', aaeggs))
def testPynocleImportsPynocle(self): """Test that importing pynocle works from a folder in the pynocle folder.""" self.buildTempDirs() expected = os.path.join(THISDIR, '__init__') self.assertEqual(expected, modulefinder.get_module_filename('pynocle', __file__))
def testFindAASpamAbs(self): """Test that the a/aa/spam.py module is found when the a/aa/eggs.py module is importing it absolutely.""" self.buildTempDirs() expected = os.path.join(self.temp_fake_aa, 'spam') aaeggs = os.path.join(self.temp_fake_aa, 'eggs.py') self.assertEqual(expected, modulefinder.get_module_filename('_fake.a.aa.spam', aaeggs))
def testRelativeImport(self): """Test that the a/aa/spam.py module is found when the a/aa/eggs.py module is importing it relatively.""" self.buildTempDirs() expected = os.path.join(self.temp_fake_aa, 'spam') aaeggs = os.path.join(self.temp_fake_aa, 'eggs.py') self.assertEqual(expected, modulefinder.get_module_filename('spam', aaeggs))
def testFindsBuiltins(self): """Test that it returns only the modulename for builtin modules.""" self.assertEqual('sys', modulefinder.get_module_filename('sys')) self.assertEqual('time', modulefinder.get_module_filename('time'))
def testPynocleImportsPynocle(self): """Test that importing pynocle works from a folder in the pynocle folder.""" self.buildTempDirs() expected = os.path.join(THISDIR, "__init__") self.assertEqual(expected, modulefinder.get_module_filename("pynocle", __file__))
def testFindAASpamAbs(self): """Test that the a/aa/spam.py module is found when the a/aa/eggs.py module is importing it absolutely.""" self.buildTempDirs() expected = os.path.join(self.temp_fake_aa, "spam") aaeggs = os.path.join(self.temp_fake_aa, "eggs.py") self.assertEqual(expected, modulefinder.get_module_filename("_fake.a.aa.spam", aaeggs))
def testRelativeImport(self): """Test that the a/aa/spam.py module is found when the a/aa/eggs.py module is importing it relatively.""" self.buildTempDirs() expected = os.path.join(self.temp_fake_aa, "spam") aaeggs = os.path.join(self.temp_fake_aa, "eggs.py") self.assertEqual(expected, modulefinder.get_module_filename("spam", aaeggs))
def testFindsBuiltins(self): """Test that it returns only the modulename for builtin modules.""" self.assertEqual("sys", modulefinder.get_module_filename("sys")) self.assertEqual("time", modulefinder.get_module_filename("time"))