From d47ff3f1c46fd8af66e03af4b708db68a13ca592 Mon Sep 17 00:00:00 2001 From: Pekka T Savolainen Date: Fri, 8 Nov 2024 18:10:23 +0200 Subject: [PATCH] Update CHANGELOG and tests --- CHANGELOG.md | 6 ++ .../widgets/add_up_spine_opt_wizard.py | 2 +- spinetoolbox/widgets/settings_widget.py | 9 +-- tests/widgets/test_AddUpSpineOptWizard.py | 68 ++++--------------- 4 files changed, 27 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5072ec659..878967878 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/) ## [0.9.1] +### Changed + +- **Add/Update SpineOpt** wizard in **File->Settings->Tools** now installs SpineOpt v0.9.0 +from Julia's General Registry. Previously SpineOpt was installed from a custom +SpineJuliaRegistry registry. + ### Removed - Removed support for MSSQL dialect. It did not work anyway. diff --git a/spinetoolbox/widgets/add_up_spine_opt_wizard.py b/spinetoolbox/widgets/add_up_spine_opt_wizard.py index e06bb90a5..40f23cfa9 100644 --- a/spinetoolbox/widgets/add_up_spine_opt_wizard.py +++ b/spinetoolbox/widgets/add_up_spine_opt_wizard.py @@ -505,7 +505,7 @@ def _initialize_page_solution2(self): self.setFinalPage(True) julia = self.field("julia_exe") env = self.field("julia_project") - self.setTitle("JULIA_SSL_CA_ROOTS_PATH environment variable missing") + self.setTitle("Environment variable JULIA_SSL_CA_ROOTS_PATH missing") description = ( "

You are most likely running Toolbox in a Conda environment and the issue " "you're facing is due to a missing environment variable. The simplest solution " diff --git a/spinetoolbox/widgets/settings_widget.py b/spinetoolbox/widgets/settings_widget.py index c6ff014a7..e6a944b56 100644 --- a/spinetoolbox/widgets/settings_widget.py +++ b/spinetoolbox/widgets/settings_widget.py @@ -444,10 +444,11 @@ def _show_add_up_spine_opt_wizard(self, _=False): """Opens the add/update SpineOpt wizard.""" use_julia_jupyter_console, julia_path, julia_project_path, julia_kernel = self._get_julia_settings() if julia_project_path != "@." and not dir_is_valid( - self, - julia_project_path, - "Invalid Julia Project", - "Julia project must be an existing directory, @., or empty"): + self, + julia_project_path, + "Invalid Julia Project", + "Julia project must be an existing directory, @., or empty", + ): return settings = QSettings("SpineProject", "AddUpSpineOptWizard") settings.setValue("appSettings/useJuliaKernel", use_julia_jupyter_console) diff --git a/tests/widgets/test_AddUpSpineOptWizard.py b/tests/widgets/test_AddUpSpineOptWizard.py index c4302fc70..f762c04eb 100644 --- a/tests/widgets/test_AddUpSpineOptWizard.py +++ b/tests/widgets/test_AddUpSpineOptWizard.py @@ -117,32 +117,17 @@ def _make_failed_wizard(self): def test_spine_opt_installation_fails(self): wizard = self._make_failed_wizard() wizard.setField("troubleshoot", False) + self.assertEqual("Installation failed", wizard.currentPage().title()) self.assertTrue(wizard.currentPage().isFinalPage()) - def test_registry_reset_succeeds(self): - wizard = self._make_failed_wizard() - wizard.next() - self.assertEqual("Troubleshooting", wizard.currentPage().title()) - wizard.setField("problem2", True) - wizard.next() - self.assertEqual("Reset Julia General Registry", wizard.currentPage().title()) - self.assertTrue(wizard.currentPage().isCommitPage()) - self.assertEqual("Install SpineOpt", wizard.currentPage().buttonText(QWizard.WizardButton.CommitButton)) - with mock.patch("spinetoolbox.execution_managers.QProcess") as MockQProcess: - MockQProcess.return_value = MockInstantQProcess(finished_args=(0, MockQProcess.NormalExit)) - wizard.next() - self.assertEqual("Installing SpineOpt", wizard.currentPage().title()) - wizard.next() - self.assertEqual("Installation successful", wizard.currentPage().title()) - self.assertTrue(wizard.currentPage().isFinalPage()) - - def test_what_now_page(self): + def test_troubleshoot_solution_page1_and_retry_spineopt_install_fails(self): wizard = self._make_failed_wizard() wizard.next() self.assertEqual("Troubleshooting", wizard.currentPage().title()) wizard.setField("problem1", True) wizard.next() self.assertEqual("What now?", wizard.currentPage().title()) + self.assertTrue(wizard.currentPage().isCommitPage()) self.assertEqual("Install SpineOpt", wizard.currentPage().buttonText(QWizard.WizardButton.CommitButton)) with mock.patch("spinetoolbox.execution_managers.QProcess") as MockQProcess: MockQProcess.return_value = MockInstantQProcess(finished_args=(-1, MockQProcess.NormalExit)) @@ -152,70 +137,47 @@ def test_what_now_page(self): self.assertEqual("Troubleshooting failed", wizard.currentPage().title()) self.assertTrue(wizard.currentPage().isFinalPage()) - def test_registry_reset_fails(self): + def test_troubleshoot_solution_page1_and_retry_spineopt_install_succeeds(self): wizard = self._make_failed_wizard() wizard.next() self.assertEqual("Troubleshooting", wizard.currentPage().title()) - wizard.setField("problem2", True) + wizard.setField("problem1", True) wizard.next() - self.assertEqual("Reset Julia General Registry", wizard.currentPage().title()) + self.assertEqual("What now?", wizard.currentPage().title()) self.assertTrue(wizard.currentPage().isCommitPage()) + self.assertFalse(wizard.currentPage().isFinalPage()) self.assertEqual("Install SpineOpt", wizard.currentPage().buttonText(QWizard.WizardButton.CommitButton)) with mock.patch("spinetoolbox.execution_managers.QProcess") as MockQProcess: - MockQProcess.return_value = MockInstantQProcess(finished_args=(-1, MockQProcess.NormalExit)) + MockQProcess.return_value = MockInstantQProcess(finished_args=(0, MockQProcess.NormalExit)) wizard.next() self.assertEqual("Installing SpineOpt", wizard.currentPage().title()) wizard.next() - self.assertEqual("Troubleshooting failed", wizard.currentPage().title()) + self.assertEqual("Installation successful", wizard.currentPage().title()) self.assertTrue(wizard.currentPage().isFinalPage()) - def test_registry_reset_succeeds_but_installing_spine_opt_fails_again_afterwards(self): + def test_troubleshoot_solution_page2(self): wizard = self._make_failed_wizard() wizard.next() self.assertEqual("Troubleshooting", wizard.currentPage().title()) wizard.setField("problem2", True) wizard.next() - self.assertEqual("Reset Julia General Registry", wizard.currentPage().title()) - self.assertTrue(wizard.currentPage().isCommitPage()) - self.assertEqual("Install SpineOpt", wizard.currentPage().buttonText(QWizard.WizardButton.CommitButton)) - with mock.patch("spinetoolbox.execution_managers.QProcess") as MockQProcess: - MockQProcess.return_value = MockInstantQProcess(finished_args=(-1, MockQProcess.NormalExit)) - wizard.next() - self.assertEqual("Installing SpineOpt", wizard.currentPage().title()) - wizard.next() - self.assertEqual("Troubleshooting failed", wizard.currentPage().title()) + self.assertEqual("Environment variable JULIA_SSL_CA_ROOTS_PATH missing", wizard.currentPage().title()) self.assertTrue(wizard.currentPage().isFinalPage()) - def test_updating_wmf_succeeds(self): + def test_troubleshoot_solution_page3(self): wizard = self._make_failed_wizard() wizard.next() self.assertEqual("Troubleshooting", wizard.currentPage().title()) wizard.setField("problem3", True) wizard.next() - self.assertEqual("Update Windows Management Framework", wizard.currentPage().title()) - self.assertTrue(wizard.currentPage().isCommitPage()) - self.assertEqual("Install SpineOpt", wizard.currentPage().buttonText(QWizard.WizardButton.CommitButton)) - with mock.patch("spinetoolbox.execution_managers.QProcess") as MockQProcess: - MockQProcess.return_value = MockInstantQProcess(finished_args=(0, MockQProcess.NormalExit)) - wizard.next() - self.assertEqual("Installing SpineOpt", wizard.currentPage().title()) - wizard.next() - self.assertEqual("Installation successful", wizard.currentPage().title()) + self.assertEqual("Reset Julia General Registry", wizard.currentPage().title()) self.assertTrue(wizard.currentPage().isFinalPage()) - def test_updating_wmf_fails(self): + def test_troubleshoot_solution_page4(self): wizard = self._make_failed_wizard() wizard.next() self.assertEqual("Troubleshooting", wizard.currentPage().title()) - wizard.setField("problem3", True) + wizard.setField("problem4", True) wizard.next() self.assertEqual("Update Windows Management Framework", wizard.currentPage().title()) - self.assertTrue(wizard.currentPage().isCommitPage()) - self.assertEqual("Install SpineOpt", wizard.currentPage().buttonText(QWizard.WizardButton.CommitButton)) - with mock.patch("spinetoolbox.execution_managers.QProcess") as MockQProcess: - MockQProcess.return_value = MockInstantQProcess(finished_args=(-1, MockQProcess.NormalExit)) - wizard.next() - self.assertEqual("Installing SpineOpt", wizard.currentPage().title()) - wizard.next() - self.assertEqual("Troubleshooting failed", wizard.currentPage().title()) self.assertTrue(wizard.currentPage().isFinalPage())