2009-03-12 19:47:53 -03:00
|
|
|
from importlib import _bootstrap
|
2009-02-01 00:00:05 -04:00
|
|
|
from . import util as source_util
|
2009-01-17 20:24:28 -04:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
|
|
class PathHookTest(unittest.TestCase):
|
|
|
|
|
|
|
|
"""Test the path hook for source."""
|
|
|
|
|
|
|
|
def test_success(self):
|
2009-02-01 00:00:05 -04:00
|
|
|
with source_util.create_modules('dummy') as mapping:
|
2010-07-03 18:48:25 -03:00
|
|
|
self.assertTrue(hasattr(_bootstrap._file_path_hook(mapping['.root']),
|
2009-01-17 20:24:28 -04:00
|
|
|
'find_module'))
|
|
|
|
|
2010-07-03 19:18:47 -03:00
|
|
|
def test_empty_string(self):
|
|
|
|
# The empty string represents the cwd.
|
|
|
|
self.assertTrue(hasattr(_bootstrap._file_path_hook(''), 'find_module'))
|
|
|
|
|
2009-01-17 20:24:28 -04:00
|
|
|
|
|
|
|
def test_main():
|
|
|
|
from test.support import run_unittest
|
|
|
|
run_unittest(PathHookTest)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test_main()
|