-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Don't trigger alias resolution when merging stubs
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""Tests for the `merger` module.""" | ||
|
||
from textwrap import dedent | ||
|
||
from griffe.loader import GriffeLoader | ||
from tests.helpers import temporary_pypackage | ||
|
||
|
||
def test_dont_trigger_alias_resolution_when_merging_stubs(): | ||
"""Assert that we don't trigger alias resolution when merging stubs.""" | ||
with temporary_pypackage("package", ["mod.py", "mod.pyi"]) as tmp_package: | ||
tmp_package.path.joinpath("mod.py").write_text( | ||
dedent( | ||
""" | ||
import pathlib | ||
def f() -> pathlib.Path: | ||
return pathlib.Path() | ||
""" | ||
) | ||
) | ||
tmp_package.path.joinpath("mod.pyi").write_text( | ||
dedent( | ||
""" | ||
import pathlib | ||
def f() -> pathlib.Path: ... | ||
""" | ||
) | ||
) | ||
loader = GriffeLoader(search_paths=[tmp_package.tmpdir]) | ||
loader.load_module(tmp_package.name) |