Skip to content

Commit

Permalink
Fix mypy issues in _load_py_cssfproject
Browse files Browse the repository at this point in the history
  • Loading branch information
Argmaster committed Apr 16, 2024
1 parent 9c196ed commit 2587354
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cssfinder/cssfproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def _load_py_cssfproject(cls, project_path: Path) -> Self:
project_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(project_module)

project_object: CSSFProject = getattr(project_module, "__project__", None)
project_object = getattr(project_module, "__project__", None)

if project_object is None:
msg = (
Expand All @@ -233,6 +233,14 @@ def _load_py_cssfproject(cls, project_path: Path) -> Self:
)
raise ImportError(msg)

if not isinstance(project_object, cls):
msg = (
f"Expected CSSFProject object in '__project__' field in {project_path}."
)
raise TypeError(
msg,
)

if not isinstance(project_object, cls):
msg = (
"Incorrect object in '__project__' field, should contain "
Expand Down

0 comments on commit 2587354

Please sign in to comment.