| 1 | n/a | from importlib import _bootstrap |
|---|
| 2 | n/a | from .. import abc |
|---|
| 3 | n/a | from . import util |
|---|
| 4 | n/a | |
|---|
| 5 | n/a | import imp |
|---|
| 6 | n/a | import unittest |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | class FinderTests(abc.FinderTests): |
|---|
| 9 | n/a | |
|---|
| 10 | n/a | """Test the finder for extension modules.""" |
|---|
| 11 | n/a | |
|---|
| 12 | n/a | def find_module(self, fullname): |
|---|
| 13 | n/a | importer = _bootstrap.FileFinder(util.PATH, |
|---|
| 14 | n/a | (_bootstrap.ExtensionFileLoader, |
|---|
| 15 | n/a | imp.extension_suffixes(), |
|---|
| 16 | n/a | False)) |
|---|
| 17 | n/a | return importer.find_module(fullname) |
|---|
| 18 | n/a | |
|---|
| 19 | n/a | def test_module(self): |
|---|
| 20 | n/a | self.assertTrue(self.find_module(util.NAME)) |
|---|
| 21 | n/a | |
|---|
| 22 | n/a | def test_package(self): |
|---|
| 23 | n/a | # Extension modules cannot be an __init__ for a package. |
|---|
| 24 | n/a | pass |
|---|
| 25 | n/a | |
|---|
| 26 | n/a | def test_module_in_package(self): |
|---|
| 27 | n/a | # No extension module in a package available for testing. |
|---|
| 28 | n/a | pass |
|---|
| 29 | n/a | |
|---|
| 30 | n/a | def test_package_in_package(self): |
|---|
| 31 | n/a | # Extension modules cannot be an __init__ for a package. |
|---|
| 32 | n/a | pass |
|---|
| 33 | n/a | |
|---|
| 34 | n/a | def test_package_over_module(self): |
|---|
| 35 | n/a | # Extension modules cannot be an __init__ for a package. |
|---|
| 36 | n/a | pass |
|---|
| 37 | n/a | |
|---|
| 38 | n/a | def test_failure(self): |
|---|
| 39 | n/a | self.assertIsNone(self.find_module('asdfjkl;')) |
|---|
| 40 | n/a | |
|---|
| 41 | n/a | # XXX Raise an exception if someone tries to use the 'path' argument? |
|---|
| 42 | n/a | |
|---|
| 43 | n/a | |
|---|
| 44 | n/a | def test_main(): |
|---|
| 45 | n/a | from test.support import run_unittest |
|---|
| 46 | n/a | run_unittest(FinderTests) |
|---|
| 47 | n/a | |
|---|
| 48 | n/a | |
|---|
| 49 | n/a | if __name__ == '__main__': |
|---|
| 50 | n/a | test_main() |
|---|