2009-01-29 20:22:35 -04:00
|
|
|
from .. import abc
|
2013-10-25 16:39:02 -03:00
|
|
|
from .. import util as test_util
|
2009-02-06 22:06:43 -04:00
|
|
|
from . import util
|
2009-01-17 20:24:28 -04:00
|
|
|
|
2013-10-25 16:39:02 -03:00
|
|
|
machinery = test_util.import_importlib('importlib.machinery')
|
|
|
|
|
2009-01-17 20:24:28 -04:00
|
|
|
import unittest
|
|
|
|
|
2013-10-25 16:39:02 -03:00
|
|
|
|
|
|
|
class FinderTests(abc.FinderTests):
|
2009-01-17 20:24:28 -04:00
|
|
|
|
|
|
|
"""Test the finder for extension modules."""
|
|
|
|
|
|
|
|
def find_module(self, fullname):
|
2013-10-25 16:39:02 -03:00
|
|
|
importer = self.machinery.FileFinder(util.PATH,
|
|
|
|
(self.machinery.ExtensionFileLoader,
|
|
|
|
self.machinery.EXTENSION_SUFFIXES))
|
2009-01-17 20:24:28 -04:00
|
|
|
return importer.find_module(fullname)
|
|
|
|
|
2009-01-26 21:33:54 -04:00
|
|
|
def test_module(self):
|
2009-06-30 20:06:06 -03:00
|
|
|
self.assertTrue(self.find_module(util.NAME))
|
2009-01-17 20:24:28 -04:00
|
|
|
|
2009-01-26 21:33:54 -04:00
|
|
|
def test_package(self):
|
2012-08-10 14:47:54 -03:00
|
|
|
# No extension module as an __init__ available for testing.
|
2009-01-26 21:33:54 -04:00
|
|
|
pass
|
|
|
|
|
|
|
|
def test_module_in_package(self):
|
|
|
|
# No extension module in a package available for testing.
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_package_in_package(self):
|
2012-08-10 14:47:54 -03:00
|
|
|
# No extension module as an __init__ available for testing.
|
2009-01-26 21:33:54 -04:00
|
|
|
pass
|
|
|
|
|
|
|
|
def test_package_over_module(self):
|
|
|
|
# Extension modules cannot be an __init__ for a package.
|
|
|
|
pass
|
|
|
|
|
2009-01-17 20:24:28 -04:00
|
|
|
def test_failure(self):
|
2012-06-28 07:15:01 -03:00
|
|
|
self.assertIsNone(self.find_module('asdfjkl;'))
|
2009-01-17 20:24:28 -04:00
|
|
|
|
2013-10-25 16:39:02 -03:00
|
|
|
Frozen_FinderTests, Source_FinderTests = test_util.test_both(
|
|
|
|
FinderTests, machinery=machinery)
|
2009-01-17 20:24:28 -04:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2013-10-25 16:39:02 -03:00
|
|
|
unittest.main()
|