2009-03-12 19:47:53 -03:00
|
|
|
from importlib import _bootstrap
|
2009-01-29 20:22:35 -04:00
|
|
|
from .. import abc
|
2009-02-06 22:06:43 -04:00
|
|
|
from . import util
|
2009-01-17 20:24:28 -04:00
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
2009-01-29 20:22:35 -04:00
|
|
|
class FinderTests(abc.FinderTests):
|
2009-01-17 20:24:28 -04:00
|
|
|
|
|
|
|
"""Test the finder for extension modules."""
|
|
|
|
|
|
|
|
def find_module(self, fullname):
|
2009-03-12 19:47:53 -03:00
|
|
|
importer = _bootstrap._ExtensionFileFinder(util.PATH)
|
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):
|
|
|
|
# Extension modules cannot be an __init__ for a package.
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_module_in_package(self):
|
|
|
|
# No extension module in a package available for testing.
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_package_in_package(self):
|
|
|
|
# Extension modules cannot be an __init__ for a package.
|
|
|
|
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):
|
2009-06-30 20:06:06 -03:00
|
|
|
self.assertTrue(self.find_module('asdfjkl;') is None)
|
2009-01-17 20:24:28 -04:00
|
|
|
|
|
|
|
# XXX Raise an exception if someone tries to use the 'path' argument?
|
|
|
|
|
|
|
|
|
|
|
|
def test_main():
|
|
|
|
from test.support import run_unittest
|
|
|
|
run_unittest(FinderTests)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test_main()
|