Staging
v0.5.2
https://github.com/python/cpython
Raw File
Tip revision: 47f075d96b9c205c6731f8599206172c3e209242 authored by Benjamin Peterson on 01 December 2020, 15:05:57 UTC
[3.7] Bumps [actions/cache](https://github.com/actions/cache) from v1 to v2.1.3. (GH-23596)
Tip revision: 47f075d
test_path_hook.py
from .. import util

machinery = util.import_importlib('importlib.machinery')

import unittest


class PathHookTests:

    """Test the path hook for extension modules."""
    # XXX Should it only succeed for pre-existing directories?
    # XXX Should it only work for directories containing an extension module?

    def hook(self, entry):
        return self.machinery.FileFinder.path_hook(
                (self.machinery.ExtensionFileLoader,
                 self.machinery.EXTENSION_SUFFIXES))(entry)

    def test_success(self):
        # Path hook should handle a directory where a known extension module
        # exists.
        self.assertTrue(hasattr(self.hook(util.EXTENSIONS.path), 'find_module'))


(Frozen_PathHooksTests,
 Source_PathHooksTests
 ) = util.test_both(PathHookTests, machinery=machinery)


if __name__ == '__main__':
    unittest.main()
back to top