diff --git a/src/Model/test_Model.py b/src/Model/test_Model.py index f42f2a67..598cfe60 100644 --- a/src/Model/test_Model.py +++ b/src/Model/test_Model.py @@ -24,6 +24,7 @@ from Model.Status import StudyStatus from Model.Study import Study from Model.River import River from Model.LateralContribution.LateralContributionTypes import LateralContrib +from Model.HydraulicStructures.Basic.Types import DischargeWeir class StudyTestCase(unittest.TestCase): diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index dd3e9dee..5ae5da9d 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -1525,6 +1525,16 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): sl.show() def open_reach_sediment_layers(self): + if self._study is None: + logger.debug( + "No study open for reach sediment layers edition..." + ) + return + + if not self._study.river.has_current_reach(): + self.msg_select_reach() + return + reach = self._study.river.current_reach().reach if self.sub_window_exists( diff --git a/src/View/test_MainWindow.py b/src/View/test_MainWindow.py deleted file mode 100644 index 338a6734..00000000 --- a/src/View/test_MainWindow.py +++ /dev/null @@ -1,29 +0,0 @@ -# test_MainWindow.py -- Pamhyr -# Copyright (C) 2026 INRAE -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# -*- coding: utf-8 -*- - -import unittest - -from types import SimpleNamespace -from unittest.mock import patch - -from View.MainWindow import ApplicationWindow - - -class MainWindowTestCase(unittest.TestCase): - @patch("View.MainWindow.subprocess.Popen") - def test_open_sqlite_with_spaces_in_study_path(self, popen): - path = "/tmp/a study with spaces/example study.pamhyr" - window = SimpleNamespace( - _study=SimpleNamespace(filename=path) - ) - - ApplicationWindow.open_sqlite(window) - - popen.assert_called_once_with(["sqlitebrowser", path])