Tests: exclude test folder itself from autmatic dataclass checks
This commit is contained in:
@@ -10,6 +10,15 @@ from clan_cli.api.util import JSchemaTypeError, type_to_dict
|
||||
from clan_cli.errors import ClanError
|
||||
|
||||
|
||||
def should_skip(file_path: Path, excludes: list[Path]) -> bool:
|
||||
file_path = file_path.resolve() # Ensure absolute path
|
||||
for exclude in excludes:
|
||||
exclude = exclude.resolve()
|
||||
if exclude in file_path.parents or exclude == file_path:
|
||||
return True # Skip this file
|
||||
return False
|
||||
|
||||
|
||||
def find_dataclasses_in_directory(
|
||||
directory: Path, exclude_paths: list[str] | None = None
|
||||
) -> list[tuple[Path, str]]:
|
||||
@@ -34,8 +43,7 @@ def find_dataclasses_in_directory(
|
||||
continue
|
||||
|
||||
file_path = Path(root) / file
|
||||
|
||||
if file_path in excludes:
|
||||
if should_skip(file_path, excludes):
|
||||
print(f"Skipping dataclass check for file: {file_path}")
|
||||
continue
|
||||
|
||||
@@ -123,6 +131,7 @@ def test_all_dataclasses() -> None:
|
||||
"api/__init__.py",
|
||||
"cmd.py", # We don't want the UI to have access to the cmd module anyway
|
||||
"async_run.py", # We don't want the UI to have access to the async_run module anyway
|
||||
"tests",
|
||||
]
|
||||
|
||||
cli_path = Path("clan_cli").resolve()
|
||||
|
||||
Reference in New Issue
Block a user