From f4af6ebc5fabf5b62ec87b580476d93d52690b08 Mon Sep 17 00:00:00 2001 From: David Perl Date: Tue, 29 Jul 2025 19:17:25 +0200 Subject: [PATCH] fix: use better source for plugin repo name --- bec_widgets/utils/bec_plugin_manager/edit_ui.py | 4 ++-- tests/unit_tests/test_plugin_creator.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bec_widgets/utils/bec_plugin_manager/edit_ui.py b/bec_widgets/utils/bec_plugin_manager/edit_ui.py index 54f444b0..cb20ed7f 100644 --- a/bec_widgets/utils/bec_plugin_manager/edit_ui.py +++ b/bec_widgets/utils/bec_plugin_manager/edit_ui.py @@ -3,7 +3,7 @@ import subprocess from pathlib import Path from bec_lib.logger import bec_logger -from bec_lib.plugin_helper import plugin_repo_path +from bec_lib.plugin_helper import plugin_package_name, plugin_repo_path from watchdog.events import ( DirCreatedEvent, DirModifiedEvent, @@ -117,7 +117,7 @@ class RecompileHandler(FileSystemEventHandler): def open_and_watch_ui_editor(widget_name: str): logger.info(f"Opening the editor for {widget_name}, and watching") repo = Path(plugin_repo_path()) - widget_dir = repo / repo.name / "bec_widgets" / "widgets" / widget_name + widget_dir = repo / plugin_package_name() / "bec_widgets" / "widgets" / widget_name ui_file = widget_dir / f"{widget_name}.ui" ui_outfile = widget_dir / f"{widget_name}_ui.py" diff --git a/tests/unit_tests/test_plugin_creator.py b/tests/unit_tests/test_plugin_creator.py index b2cf6852..4d9e898e 100644 --- a/tests/unit_tests/test_plugin_creator.py +++ b/tests/unit_tests/test_plugin_creator.py @@ -207,8 +207,10 @@ class TestAddWidgetVariants: @patch("bec_widgets.utils.bec_plugin_manager.edit_ui.open_designer") @patch("bec_widgets.utils.bec_plugin_manager.edit_ui.plugin_repo_path") @patch("bec_widgets.utils.bec_plugin_manager.create.widget.plugin_repo_path") + @patch("bec_widgets.utils.bec_plugin_manager.edit_ui.plugin_package_name") def test_widget_editor_watcher( self, + plugin_package_name, plugin_repo_path, plugin_repo_path_2, open_designer, @@ -218,6 +220,7 @@ class TestAddWidgetVariants: ): plugin_repo_path.return_value = str(git_repo) plugin_repo_path_2.return_value = str(git_repo) + plugin_package_name.return_value = git_repo.name widget_dir = git_repo / "test_plugin" / "bec_widgets" / "widgets" / "test_widget_6" widget_ui_file = widget_dir / "test_widget_6.ui"