blob: 5262aaab92188636db8761731b33fa725a8d0f0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import importlib
from .. import support
import sys
import unittest
class FinderTests(unittest.TestCase):
"""Test find_module() for built-in modules."""
assert 'errno' in sys.builtin_module_names
name = 'errno'
find_module = staticmethod(lambda name, path=None:
importlib.BuiltinImporter().find_module(name, path))
def test_find_module(self):
# Common case.
with support.uncache(self.name):
self.assert_(self.find_module(self.name))
def test_ignore_path(self):
# The value for 'path' should always trigger a failed import.
with support.uncache(self.name):
self.assert_(self.find_module(self.name, ['pkg']) is None)
def test_main():
from test.support import run_unittest
run_unittest(FinderTests)
if __name__ == '__main__':
test_main()
|