Skip to content

Commit

Permalink
Update CHANGELOG and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol committed Nov 8, 2024
1 parent d20ea25 commit d47ff3f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 58 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion spinetoolbox/widgets/add_up_spine_opt_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def _initialize_page_solution2(self):
self.setFinalPage(True)
julia = self.field("julia_exe")
env = self.field("julia_project")
self.setTitle("<b>JULIA_SSL_CA_ROOTS_PATH</b> environment variable missing")
self.setTitle("Environment variable JULIA_SSL_CA_ROOTS_PATH missing")
description = (
"<p>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 "
Expand Down
9 changes: 5 additions & 4 deletions spinetoolbox/widgets/settings_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 452 in spinetoolbox/widgets/settings_widget.py

View check run for this annotation

Codecov / codecov/patch

spinetoolbox/widgets/settings_widget.py#L452

Added line #L452 was not covered by tests
settings = QSettings("SpineProject", "AddUpSpineOptWizard")
settings.setValue("appSettings/useJuliaKernel", use_julia_jupyter_console)
Expand Down
68 changes: 15 additions & 53 deletions tests/widgets/test_AddUpSpineOptWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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())

0 comments on commit d47ff3f

Please sign in to comment.