2009-01-17 20:24:28 -04:00
|
|
|
import importlib
|
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-02-20 23:15:37 -04:00
|
|
|
importer = importlib.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-02-06 22:06:43 -04:00
|
|
|
self.assert_(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):
|
|
|
|
self.assert_(self.find_module('asdfjkl;') is None)
|
|
|
|
|
|
|
|
# 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()
|