forked from Rust-related/RustPython
* Mark 3.12 * Update importlib from Python 3.12.0 * Update test_importlib from Python3.12 * Mark failings tests from importlib * Update test.support from Python3.12 * Fix unsupported parser feature * mark failing test * Update functools from Python 3.12 * manual type annotation * slice behavior changed in 3.12 * empty unittest.main returns non-zero * test_decimal from CPython 3.12 * Mark failing tests * Update test_unicode from CPython 3.12 * Update test_functools from Python 3.12 * Update enum from Python 3.12 * enum * Doc format changed * Update test_module from CPython --------- Co-authored-by: CPython developers <>
32 lines
879 B
Python
Vendored
32 lines
879 B
Python
Vendored
from test.test_importlib 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_spec'))
|
|
|
|
|
|
(Frozen_PathHooksTests,
|
|
Source_PathHooksTests
|
|
) = util.test_both(PathHookTests, machinery=machinery)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|