Skip to content

Commit aefa523

Browse files
committed
Change test_is_importable
Removed the test for standalone module because for some reason it was flaky (could not figure why).
1 parent 3489fa3 commit aefa523

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

testing/test_pathlib.py

+11-14
Original file line numberDiff line numberDiff line change
@@ -1376,29 +1376,26 @@ def test_full_ns_packages_without_init_files(
13761376
def test_is_importable(pytester: Pytester) -> None:
13771377
pytester.syspathinsert()
13781378

1379-
# Module package.
1380-
path = pytester.path / "is_importable/foo.py"
1379+
path = pytester.path / "bar/foo.py"
13811380
path.parent.mkdir()
13821381
path.touch()
1383-
assert is_importable("is_importable.foo", path) is True
1384-
1385-
# Standalone module.
1386-
path = pytester.path / "is_importable_module.py"
1387-
path.touch()
1388-
assert is_importable("is_importable_module", path) is True
1382+
assert is_importable("bar.foo", path) is True
13891383

13901384
# Ensure that the module that can be imported points to the path we expect.
1391-
path = pytester.path / "some/other/path/is_importable_module.py"
1392-
assert is_importable("is_importable_module", path) is False
1385+
path = pytester.path / "some/other/path/bar/foo.py"
1386+
path.mkdir(parents=True, exist_ok=True)
1387+
assert is_importable("bar.foo", path) is False
13931388

13941389
# Paths containing "." cannot be imported.
1395-
path = pytester.path / "bar.x"
1396-
path.mkdir()
1390+
path = pytester.path / "bar.x/__init__.py"
1391+
path.parent.mkdir()
1392+
path.touch()
13971393
assert is_importable("bar.x", path) is False
13981394

13991395
# Pass starting with "." denote relative imports and cannot be checked using is_importable.
1400-
path = pytester.path / ".bar.x"
1401-
path.mkdir()
1396+
path = pytester.path / ".bar.x/__init__.py"
1397+
path.parent.mkdir()
1398+
path.touch()
14021399
assert is_importable(".bar.x", path) is False
14031400

14041401

0 commit comments

Comments
 (0)