Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Add tests with the same path over different sys.path cases
Browse files Browse the repository at this point in the history
  • Loading branch information
gbroques committed Aug 7, 2020
1 parent cbf1c60 commit dde693f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/tests/parser_test.py
Expand Up @@ -616,6 +616,24 @@ def test_module_publicity_with_private_paths(private_path):
assert not module.is_public


@pytest.mark.parametrize("syspath,is_public", (
("/", False),
("_foo/", True),
))
def test_module_publicity_with_different_sys_path(syspath,
is_public,
monkeypatch):
"""Test module publicity for same path and different sys.path."""
parser = Parser()
code = CodeSnippet("")

monkeypatch.syspath_prepend(syspath)

path = Path("_foo") / "bar" / "baz.py"
module = parser.parse(code, str(path))
assert module.is_public == is_public


def test_complex_module():
"""Test that a complex module is parsed correctly."""
parser = Parser()
Expand Down

0 comments on commit dde693f

Please sign in to comment.