diff --git a/pyproject.toml b/pyproject.toml index 05f2c1b..1b95058 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,9 +54,6 @@ packages = ["aprsd_twitter_plugin"] [project.entry-points."oslo.config.opts"] "aprsd_twitter_plugin.conf" = "aprsd_twitter_plugin.conf.opts:list_opts" # type: ignore -[project.entry-points."oslo.config.opts.defaults"] - "aprsd_twitter_plugin.conf" = "aprsd_twitter_plugin.conf.opts:defaults" # type: ignore - [project.scripts] "aprsd-twitter-plugin-export-config" = "aprsd_twitter_plugin.cli:main" diff --git a/tests/test_oslo_config_entry_points.py b/tests/test_oslo_config_entry_points.py new file mode 100644 index 0000000..c365dd6 --- /dev/null +++ b/tests/test_oslo_config_entry_points.py @@ -0,0 +1,31 @@ +"""Verify oslo.config entry points declared in pyproject.toml resolve. + +Regression test for the `aprsd sample-config` AttributeError caused by a +`oslo.config.opts.defaults` entry point pointing at a nonexistent +`defaults` function (see handover session-state-2026-09-24.json). +""" + +import importlib +import tomllib +from pathlib import Path + + +def _entry_points(): + root = Path(__file__).resolve().parents[1] + pyproject = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8")) + return pyproject["project"]["entry-points"] + + +def test_oslo_config_entry_points_resolve(): + """Every oslo.config entry point target must resolve to a real attribute.""" + entry_points = _entry_points() + for group, targets in entry_points.items(): + if not group.startswith("oslo.config.opts"): + continue + for target in targets.values(): + module_name, _, attr = target.partition(":") + module = importlib.import_module(module_name) + assert hasattr(module, attr), ( + f"{group} entry point '{target}' does not resolve: " + f"module '{module_name}' has no attribute '{attr}'" + )