Beispiel #1
0
def test_get_module_name(tmp_path: Path):
    root = tmp_path / 'project'
    root.mkdir()
    path = root / 'example.py'
    path.touch()
    assert StubsManager._get_module_name(path=path) == 'example'

    (root / '__init__.py').touch()
    assert StubsManager._get_module_name(path=path) == 'project.example'
Beispiel #2
0
def test_get_module_name_for_real_modules(tmp_path: Path, given, expected):
    module = import_module(given)
    path = Path(module.__file__)
    assert StubsManager._get_module_name(path=path) == expected