From 3210b1b494ac696d72af8534e7ff5d407c804cab Mon Sep 17 00:00:00 2001 From: Tanisha Panchal Date: Wed, 2 Sep 2026 22:18:44 +0530 Subject: [PATCH 1/4] Fix configure backend dispatch --- ebuild/build/dispatch.py | 9 +-------- tests/ebuild/test_dispatch.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ebuild/build/dispatch.py b/ebuild/build/dispatch.py index 0d708df..cf2014f 100644 --- a/ebuild/build/dispatch.py +++ b/ebuild/build/dispatch.py @@ -130,14 +130,7 @@ def configure( f"Supported backends: {', '.join(sorted(ALL_BACKENDS))}" ) - else: - raise RuntimeError( - f"BackendDispatcher cannot configure backend '{backend}'. " - "This dispatcher only handles cmake, meson, and cargo " - "(make/kbuild need no configure step). ebuild's own ninja " - "backend is invoked directly and requires 'targets' in " - "build.yaml -- add targets or choose another backend." - ) + def build( self, diff --git a/tests/ebuild/test_dispatch.py b/tests/ebuild/test_dispatch.py index aa71c39..68156c4 100644 --- a/tests/ebuild/test_dispatch.py +++ b/tests/ebuild/test_dispatch.py @@ -63,6 +63,18 @@ def test_cmake_takes_priority_over_makefile(self, tmp_path): # ── BackendDispatcher — unknown backend ───────────────────── +class TestConfigureBackends: + """Verify configure() handles supported backends correctly.""" + + @pytest.mark.parametrize("backend", ["cargo", "make", "kbuild", "ninja"]) + @patch("ebuild.build.dispatch.subprocess") + def test_no_configure_backends_are_noop( + self, mock_sub, tmp_path, backend + ): + d = BackendDispatcher(tmp_path, tmp_path / "build") + d.configure(backend) + mock_sub.run.assert_not_called() + class TestUnknownBackend: """Unknown backends must raise ValueError rather than silently skip.""" From 39d1d2adc3982044a5ce44b5c87a16e9951ca495 Mon Sep 17 00:00:00 2001 From: Tanisha Panchal Date: Thu, 3 Sep 2026 00:25:01 +0530 Subject: [PATCH 2/4] Fix configure backend regression test --- tests/ebuild/test_dispatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ebuild/test_dispatch.py b/tests/ebuild/test_dispatch.py index ffcf1de..3a0daf7 100644 --- a/tests/ebuild/test_dispatch.py +++ b/tests/ebuild/test_dispatch.py @@ -68,7 +68,7 @@ def test_cmake_takes_priority_over_makefile(self, tmp_path): class TestConfigureBackends: """Verify configure() handles supported backends correctly.""" - @pytest.mark.parametrize("backend", ["cargo", "make", "kbuild", "ninja"]) + @pytest.mark.parametrize("backend", ["cargo", "make", "kbuild"]) @patch("ebuild.build.dispatch.subprocess") def test_no_configure_backends_are_noop( self, mock_sub, tmp_path, backend From 316070f8ecf1c31fca73e889cd30afac6e7e6dca Mon Sep 17 00:00:00 2001 From: Tanisha Panchal Date: Fri, 4 Sep 2026 02:09:29 +0530 Subject: [PATCH 3/4] test(dispatch): organize configure backend coverage --- tests/ebuild/test_dispatch.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/ebuild/test_dispatch.py b/tests/ebuild/test_dispatch.py index 3a0daf7..9eb417c 100644 --- a/tests/ebuild/test_dispatch.py +++ b/tests/ebuild/test_dispatch.py @@ -63,7 +63,8 @@ def test_cmake_takes_priority_over_makefile(self, tmp_path): assert detect_backend(tmp_path) == "cmake" -# ── BackendDispatcher — unknown backend ───────────────────── +# ── BackendDispatcher — configure ─────────────────────────── + class TestConfigureBackends: """Verify configure() handles supported backends correctly.""" @@ -78,6 +79,9 @@ def test_no_configure_backends_are_noop( mock_sub.run.assert_not_called() +# ── BackendDispatcher — unknown backend ───────────────────── + + class TestUnknownBackend: """Unknown backends must raise BackendError rather than silently skip.""" From 67498e1e126ba7acb8507f0b3e772ef1e8e74efc Mon Sep 17 00:00:00 2001 From: Tanisha Panchal Date: Sat, 5 Sep 2026 16:07:32 +0530 Subject: [PATCH 4/4] test(dispatch): strengthen configure backend coverage --- tests/ebuild/test_dispatch.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/tests/ebuild/test_dispatch.py b/tests/ebuild/test_dispatch.py index 9eb417c..fb64bb2 100644 --- a/tests/ebuild/test_dispatch.py +++ b/tests/ebuild/test_dispatch.py @@ -63,22 +63,6 @@ def test_cmake_takes_priority_over_makefile(self, tmp_path): assert detect_backend(tmp_path) == "cmake" -# ── BackendDispatcher — configure ─────────────────────────── - - -class TestConfigureBackends: - """Verify configure() handles supported backends correctly.""" - - @pytest.mark.parametrize("backend", ["cargo", "make", "kbuild"]) - @patch("ebuild.build.dispatch.subprocess") - def test_no_configure_backends_are_noop( - self, mock_sub, tmp_path, backend - ): - d = BackendDispatcher(tmp_path, tmp_path / "build") - d.configure(backend) - mock_sub.run.assert_not_called() - - # ── BackendDispatcher — unknown backend ───────────────────── @@ -220,6 +204,7 @@ def test_configure_ninja_raises_instead_of_silently_passing(self, tmp_path): d = BackendDispatcher(tmp_path, tmp_path / "build") with pytest.raises(UnknownBackendError, match="ninja"): d.configure("ninja") + assert not (tmp_path / "build").exists() def test_ninja_error_explains_the_targets_requirement(self, tmp_path): """The message must be actionable, not just a rejection.""" @@ -243,8 +228,10 @@ def test_clean_still_accepts_ninja(self, tmp_path): d = BackendDispatcher(tmp_path, tmp_path / "build") d.clean("ninja", dry_run=True) # must not raise - def test_no_configure_step_backends_stay_noops(self, tmp_path): + @patch("ebuild.build.dispatch.subprocess") + def test_no_configure_step_backends_stay_noops(self, mock_sub, tmp_path): """cargo/make/kbuild are accepted-and-skipped, not errors.""" d = BackendDispatcher(tmp_path, tmp_path / "build") for backend in ("cargo", "make", "kbuild"): - d.configure(backend) # must not raise + d.configure(backend) + mock_sub.run.assert_not_called()