mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
23 lines
686 B
Python
23 lines
686 B
Python
|
from __future__ import annotations
|
||
|
|
||
|
import sys
|
||
|
from pathlib import Path
|
||
|
|
||
|
from sphinx.ext.autodoc.importer import import_module
|
||
|
|
||
|
|
||
|
def test_import_native_module_stubs(rootdir: Path) -> None:
|
||
|
fish_licence_root = rootdir / 'test-ext-apidoc-duplicates'
|
||
|
|
||
|
sys_path = list(sys.path)
|
||
|
sys.path.insert(0, str(fish_licence_root))
|
||
|
halibut = import_module('fish_licence.halibut')
|
||
|
sys.path[:] = sys_path
|
||
|
|
||
|
assert halibut.__file__.endswith('halibut.pyi')
|
||
|
assert halibut.__spec__.origin.endswith('halibut.pyi')
|
||
|
|
||
|
halibut_path = Path(halibut.__file__).resolve()
|
||
|
assert halibut_path.is_file()
|
||
|
assert halibut_path == fish_licence_root / 'fish_licence' / 'halibut.pyi'
|