Method: pylint.testutils.functional.find_functional_tests._check_functional_tests_structure
Calls: 259, Exceptions: 3, Paths: 14Back
Path 1: 81 calls (0.31)
PosixPath (81)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 2: 57 calls (0.22)
PosixPath (57)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 3: 45 calls (0.17)
PosixPath (45)
None (45)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 4: 33 calls (0.13)
PosixPath (33)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 5: 16 calls (0.06)
PosixPath (16)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 6: 7 calls (0.03)
PosixPath (7)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 7: 6 calls (0.02)
PosixPath (6)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 8: 5 calls (0.02)
PosixPath (5)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 9: 2 calls (0.01)
PosixPath (2)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 10: 2 calls (0.01)
PosixPath (2)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 11: 2 calls (0.01)
PosixPath (2)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 12: 1 calls (0.0)
PosixPath (1)
AssertionError (1)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 13: 1 calls (0.0)
PosixPath (1)
AssertionError (1)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"
Path 14: 1 calls (0.0)
PosixPath (1)
AssertionError (1)
1def _check_functional_tests_structure(directory: Path) -> None:
2 """Check if test directories follow correct file/folder structure."""
3 # Ignore underscored directories
4 if Path(directory).stem.startswith("_"):
5 return
6
7 files: set[Path] = set()
8 dirs: set[Path] = set()
9
10 # Collect all sub-directories and files in directory
11 for file_or_dir in directory.iterdir():
12 if file_or_dir.is_file():
13 if file_or_dir.suffix == ".py" and not file_or_dir.stem.startswith("_"):
14 files.add(file_or_dir)
15 elif file_or_dir.is_dir():
16 dirs.add(file_or_dir)
17 _check_functional_tests_structure(file_or_dir)
18
19 assert len(files) <= REASONABLY_DISPLAYABLE_VERTICALLY, (
20 f"{directory} contains too many functional tests files "
21 + f"({len(files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})."
22 )
23
24 for file in files:
25 possible_dir = file.parent / file.stem.split("_")[0]
26 assert not possible_dir.exists(), f"{file} should go in {possible_dir}."
27
28 # Exclude some directories as they follow a different structure
29 if (
30 not len(file.parent.stem) == 1 # First letter sub-directories
31 and file.parent.stem not in IGNORED_PARENT_DIRS
32 and file.parent.parent.stem not in IGNORED_PARENT_PARENT_DIRS
33 ):
34 assert file.stem.startswith(
35 file.parent.stem
36 ), f"{file} should not go in {file.parent}"