From c76174eb149a0e4fac854c12ed77b6bb0e18d4d4 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Sat, 28 Sep 2024 22:11:02 +0200 Subject: [PATCH] Try fixing test_setup.py --- tests/test_setup.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tests/test_setup.py b/tests/test_setup.py index e81e87410..7d421d89d 100644 --- a/tests/test_setup.py +++ b/tests/test_setup.py @@ -1,24 +1,27 @@ -import scc import pkgutil +import toml + +import scc + + class TestSetup(object): - """ - Tests if SCC should be installable. - """ - + """Test if SCC should be installable.""" + def test_packages(self): - """ - Tests if every known Action is documentated in docs/actions.md - """ + """Test if every known Action is documented in docs/actions.md.""" try: import gi - gi.require_version('Gtk', '3.0') - gi.require_version('GdkX11', '3.0') - gi.require_version('Rsvg', '2.0') + gi.require_version('Gtk', '3.0') + gi.require_version('GdkX11', '3.0') + gi.require_version('Rsvg', '2.0') except ImportError: pass - - from setup import packages + + # Load the packages from pyproject.toml + pyproject = toml.load("pyproject.toml") + packages = pyproject["tool"]["setuptools"]["packages"] + for importer, modname, ispkg in pkgutil.walk_packages(path=scc.__path__, prefix="scc.", onerror=lambda x: None): if ispkg: - assert modname in packages, "Package '%s' is not being installed by setup.py" % (modname,) + assert modname in packages, f"Package '{modname}' is not being installed by setup.py"