1
0
forked from VimPlug/jedi

Add tests for 'test_get_parent_dir_with_file' and 'test_is_potential_project'

This commit is contained in:
Adrian Labbé
2020-12-06 15:26:20 -03:00
parent 12a2d10595
commit 47e60107b2
2 changed files with 29 additions and 0 deletions

View File

@@ -108,3 +108,13 @@ def test_transform_path_to_dotted(sys_path_, module_path, expected, is_package):
module_path = os.path.abspath(module_path)
assert sys_path.transform_path_to_dotted(sys_path_, Path(module_path)) \
== (expected, is_package)
@pytest.mark.parametrize(
'path,filename,expected', [
(Path(__file__).parents[1], "setup.py", Path(__file__).parents[2]),
(Path(__file__).parents[2], os.path.basename(__file__), None)
]
)
def test_get_parent_dir_with_file(path, filename, expected):
assert sys_path._get_parent_dir_with_file(path, filename) == expected