From 9ed9c1b3b6bd2590c6a08ee72df423c618877e33 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:26:52 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/snapred/backend/dao/indexing/Versioning.py | 1 + tests/unit/meta/test_Decorators.py | 2 +- .../unit/ui/presenter/test_InitializeStatePresenter.py | 10 +++++----- tests/unit/ui/view/test_CalibrationAssessmentView.py | 5 +++-- tests/unit/ui/view/test_InitializeStateCheckView.py | 3 ++- tests/unit/ui/widget/test_Workflow.py | 2 +- tests/unit/ui/workflow/test_DiffCalWorkflow.py | 6 +++--- tests/unit/ui/workflow/test_WorkflowImplementer.py | 4 ++-- 8 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/snapred/backend/dao/indexing/Versioning.py b/src/snapred/backend/dao/indexing/Versioning.py index 39b99452a..7657baa00 100644 --- a/src/snapred/backend/dao/indexing/Versioning.py +++ b/src/snapred/backend/dao/indexing/Versioning.py @@ -1,4 +1,5 @@ from pydantic import BaseModel, ConfigDict, field_validator + from snapred.meta.Config import Config from snapred.meta.Enum import StrEnum diff --git a/tests/unit/meta/test_Decorators.py b/tests/unit/meta/test_Decorators.py index 2c5e8509d..1bf4f61cd 100644 --- a/tests/unit/meta/test_Decorators.py +++ b/tests/unit/meta/test_Decorators.py @@ -184,7 +184,7 @@ def setText(self, text): self.text = text -@pytest.mark.ui() +@pytest.mark.ui def test_resettable(qtbot): parent = QWidget() qtbot.addWidget(parent) diff --git a/tests/unit/ui/presenter/test_InitializeStatePresenter.py b/tests/unit/ui/presenter/test_InitializeStatePresenter.py index e1f022300..1e7a3def7 100644 --- a/tests/unit/ui/presenter/test_InitializeStatePresenter.py +++ b/tests/unit/ui/presenter/test_InitializeStatePresenter.py @@ -31,7 +31,7 @@ def setup_view_and_workflow(): return view, workflow -@pytest.mark.ui() +@pytest.mark.ui def test_handleButtonClicked_with_valid_input(setup_view_and_workflow): view, workflow = setup_view_and_workflow view.getRunNumber.return_value = "12345" @@ -43,7 +43,7 @@ def test_handleButtonClicked_with_valid_input(setup_view_and_workflow): mock_initializeState.assert_called_once_with("12345", "Test State", True) -@pytest.mark.ui() +@pytest.mark.ui def test_handleButtonClicked_with_invalid_input(setup_view_and_workflow): view, workflow = setup_view_and_workflow view.getRunNumber.return_value = "invalid" @@ -53,7 +53,7 @@ def test_handleButtonClicked_with_invalid_input(setup_view_and_workflow): mock_warning.assert_called_once() -@pytest.mark.ui() +@pytest.mark.ui def test__initializeState(setup_view_and_workflow): view, workflow = setup_view_and_workflow view.getRunNumber.return_value = "12345" @@ -69,7 +69,7 @@ def test__initializeState(setup_view_and_workflow): mock_dialog_showSuccess.assert_called_once() -@pytest.mark.ui() +@pytest.mark.ui def test__handleResponse_error(setup_view_and_workflow): view, workflow = setup_view_and_workflow error_response = SNAPResponse(code=ResponseCode.ERROR, message="Error message") @@ -82,7 +82,7 @@ def test__handleResponse_error(setup_view_and_workflow): mock_critical.assert_called_once() -@pytest.mark.ui() +@pytest.mark.ui def test__handleResponse_success(setup_view_and_workflow): view, workflow = setup_view_and_workflow success_response = SNAPResponse(code=ResponseCode.OK) diff --git a/tests/unit/ui/view/test_CalibrationAssessmentView.py b/tests/unit/ui/view/test_CalibrationAssessmentView.py index 85e729427..8990064b7 100644 --- a/tests/unit/ui/view/test_CalibrationAssessmentView.py +++ b/tests/unit/ui/view/test_CalibrationAssessmentView.py @@ -1,11 +1,12 @@ from unittest.mock import MagicMock import pytest + from snapred.backend.dao.indexing.IndexEntry import IndexEntry from snapred.ui.view.DiffCalAssessmentView import DiffCalAssessmentView -@pytest.mark.ui() +@pytest.mark.ui def test_calibration_record_dropdown(qtbot): view = DiffCalAssessmentView() assert view.getCalibrationRecordCount() == 0 @@ -28,7 +29,7 @@ def test_calibration_record_dropdown(qtbot): assert view.getSelectedCalibrationRecordData() == (runNumber, useLiteMode, version) -@pytest.mark.ui() +@pytest.mark.ui def test_error_on_load_calibration_record(qtbot): view = DiffCalAssessmentView() qtbot.addWidget(view.loadButton) diff --git a/tests/unit/ui/view/test_InitializeStateCheckView.py b/tests/unit/ui/view/test_InitializeStateCheckView.py index 72b3ebc80..51908eec7 100644 --- a/tests/unit/ui/view/test_InitializeStateCheckView.py +++ b/tests/unit/ui/view/test_InitializeStateCheckView.py @@ -1,8 +1,9 @@ import pytest + from snapred.ui.view.InitializeStateCheckView import InitializationMenu -@pytest.mark.ui() +@pytest.mark.ui def test_run_number_field(qtbot): menu = InitializationMenu(None) qtbot.addWidget(menu) diff --git a/tests/unit/ui/widget/test_Workflow.py b/tests/unit/ui/widget/test_Workflow.py index 40df3b2fb..ef05416de 100644 --- a/tests/unit/ui/widget/test_Workflow.py +++ b/tests/unit/ui/widget/test_Workflow.py @@ -40,7 +40,7 @@ def continueAction(workflowPresenter): # noqa: ARG001 return WorkflowBuilder().addNode(continueAction, view, "Test").build() -@pytest.mark.ui() +@pytest.mark.ui def test_workflowPresenterHandleContinueButtonClicked(qtbot): # Mock the worker pool mockWorkerPool = MagicMock() diff --git a/tests/unit/ui/workflow/test_DiffCalWorkflow.py b/tests/unit/ui/workflow/test_DiffCalWorkflow.py index b9db5e5b8..d6ab83870 100644 --- a/tests/unit/ui/workflow/test_DiffCalWorkflow.py +++ b/tests/unit/ui/workflow/test_DiffCalWorkflow.py @@ -14,7 +14,7 @@ from snapred.ui.workflow.DiffCalWorkflow import DiffCalWorkflow -@pytest.mark.ui() +@pytest.mark.ui @patch("snapred.ui.workflow.DiffCalWorkflow.WorkflowImplementer.request") def test_purge_bad_peaks(workflowRequest, qtbot): # noqa: ARG001 """ @@ -66,7 +66,7 @@ def test_purge_bad_peaks(workflowRequest, qtbot): # noqa: ARG001 ) -@pytest.mark.ui() +@pytest.mark.ui @patch("snapred.ui.workflow.DiffCalWorkflow.WorkflowImplementer.request") def test_purge_bad_peaks_two_wkspindex(workflowRequest, qtbot): # noqa: ARG001 """ @@ -128,7 +128,7 @@ def test_purge_bad_peaks_two_wkspindex(workflowRequest, qtbot): # noqa: ARG001 ) -@pytest.mark.ui() +@pytest.mark.ui @patch("snapred.ui.workflow.DiffCalWorkflow.WorkflowImplementer.request") def test_purge_bad_peaks_too_few(workflowRequest, qtbot): # noqa: ARG001 """ diff --git a/tests/unit/ui/workflow/test_WorkflowImplementer.py b/tests/unit/ui/workflow/test_WorkflowImplementer.py index ea5c9af81..2f3dbd671 100644 --- a/tests/unit/ui/workflow/test_WorkflowImplementer.py +++ b/tests/unit/ui/workflow/test_WorkflowImplementer.py @@ -7,7 +7,7 @@ from snapred.ui.workflow.WorkflowImplementer import WorkflowImplementer -@pytest.mark.ui() +@pytest.mark.ui def test_rename_on_iterate_list(qtbot): # noqa: ARG001 """ Test that on iteration, a list of workspaces will be renamed according to the iteration template. @@ -26,7 +26,7 @@ def test_rename_on_iterate_list(qtbot): # noqa: ARG001 assert instance.collectedOutputs == newNames -@pytest.mark.ui() +@pytest.mark.ui def test_rename_on_iterate_group(qtbot): # noqa: ARG001 """ Test that on iteration, a workspace group has all of its members renamed.