diff --git a/pyproject.toml b/pyproject.toml index bd8fb70..e6a9be9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,8 @@ kataloger = "kataloger.__main__:main" "Changelog" = "https://github.com/dzmpr/kataloger/releases" [tool.pytest.ini_options] -pythonpath = "src/" +pythonpath = "src" +testpaths = "tests" [tool.ruff] line-length = 120 diff --git a/src/kataloger/cli/argument_parser.py b/src/kataloger/cli/argument_parser.py index d0a137a..1b0aa99 100644 --- a/src/kataloger/cli/argument_parser.py +++ b/src/kataloger/cli/argument_parser.py @@ -1,5 +1,5 @@ from argparse import ArgumentParser -from importlib.metadata import version +from importlib.metadata import PackageNotFoundError, version from pathlib import Path from typing import List, Optional @@ -76,7 +76,11 @@ def parse_arguments(*args: str) -> KatalogerArguments: def _get_kataloger_version() -> str: if __name__ == "__main__": return "indev" - return version(package_name) + + try: + return version(package_name) + except PackageNotFoundError: + return "unknown" def _get_catalogs(path_strings: List[str]) -> Optional[List[Catalog]]: