From f6aeeebc2c0b770e60188ec46161540106df25dd Mon Sep 17 00:00:00 2001 From: AJ Kerrigan Date: Fri, 13 Dec 2024 10:03:48 -0500 Subject: [PATCH] test the pyprojectexception case --- src/poetry_plugin_freeze/app.py | 4 ++-- tests/fixtures/non_poetry_package/pyproject.toml | 5 +++++ tests/test_freeze.py | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 tests/fixtures/non_poetry_package/pyproject.toml diff --git a/src/poetry_plugin_freeze/app.py b/src/poetry_plugin_freeze/app.py index 6939b58..c75321c 100644 --- a/src/poetry_plugin_freeze/app.py +++ b/src/poetry_plugin_freeze/app.py @@ -60,8 +60,8 @@ def handle(self) -> int: iced = IcedPoet(project_root, self.option("wheel-dir"), self.option("exclude")) iced.check() fridge[iced.name] = iced - except PyProjectException: - pass + except PyProjectException as err: + self.line_error(f"skipping {project_root}: {err}") for iced in fridge.values(): iced.set_fridge(fridge) diff --git a/tests/fixtures/non_poetry_package/pyproject.toml b/tests/fixtures/non_poetry_package/pyproject.toml new file mode 100644 index 0000000..196ffc4 --- /dev/null +++ b/tests/fixtures/non_poetry_package/pyproject.toml @@ -0,0 +1,5 @@ +[project] +name = "non-poetry-package" +readme = "README.md" +requires-python = ">=3.12" +dependencies = [] diff --git a/tests/test_freeze.py b/tests/test_freeze.py index 98ae5fd..631204e 100644 --- a/tests/test_freeze.py +++ b/tests/test_freeze.py @@ -1,4 +1,5 @@ import csv +import re import zipfile from email.parser import Parser from io import StringIO @@ -15,12 +16,14 @@ def test_project_roots(fixture_root): fixture_root / "nested_packages", fixture_root / "nested_packages" / "others" / "app_c", fixture_root / "nested_packages" / "others" / "app_with_extras", + fixture_root / "non_poetry_package", ] def test_excluded_config_path_project_roots(fixture_root): assert sorted(project_roots(fixture_root, fixture_root / "nested_packages" / "others")) == [ - fixture_root / "nested_packages" + fixture_root / "nested_packages", + fixture_root / "non_poetry_package", ] @@ -62,6 +65,8 @@ def mock_freeze(self): assert poet_options["wheel_dir"] == "dist" assert poet_options["exclude_packages"] == [] + assert re.match("skipping.*non_poetry_package", cmd.io.fetch_error()) + def test_freeze_nested(fixture_root, fixture_copy): package = fixture_copy(fixture_root / "nested_packages")