Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
args: [--maxkb=8192]
Expand All @@ -21,15 +21,15 @@ repos:
- id: trailing-whitespace
exclude: "tests/cis_tests/.*"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.13
rev: v0.15.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: "tests/cis_tests/.*"
- id: ruff-format
exclude: "tests/cis_tests/.*"
- repo: https://github.com/pypa/pip-audit
rev: v2.9.0
rev: v2.10.0
hooks:
- id: pip-audit
# disable for now
Expand Down
41 changes: 24 additions & 17 deletions tests/integration/test_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ def _setup_gui(self, qapp):

self._warningMessageBox = mock.patch(
"qtpy.QtWidgets.QMessageBox.warning",
lambda *args, **kwargs: pytest.fail(
"WARNING This test seems to be missing expected calibration and/or normalization data", pytrace=False
)
if "Reduction is missing calibration data," in args[2]
else pytest.fail("WARNING messagebox:\n" + f" args: {args}\n" + f" kwargs: {kwargs}", pytrace=False),
lambda *args, **kwargs: (
pytest.fail(
"WARNING This test seems to be missing expected calibration and/or normalization data",
pytrace=False,
)
if "Reduction is missing calibration data," in args[2]
else pytest.fail(
"WARNING messagebox:\n" + f" args: {args}\n" + f" kwargs: {kwargs}", pytrace=False
)
),
)
self._warningMessageBox.start()

Expand All @@ -63,18 +68,20 @@ def _setup_gui(self, qapp):
# patch log-warnings QMessage box: runs using `QMessageBox.exec`.
self._logWarningsMessageBox = mock.patch(
"qtpy.QtWidgets.QMessageBox.exec",
lambda self, *args, **kwargs: QMessageBox.Ok
if (
"The backend has encountered warning(s)" in self.text()
and "InstrumentDonor will only be used if GroupingFilename is in XML format." in self.detailedText()
)
else pytest.fail(
"unexpected QMessageBox.exec:"
+ f" args: {args}"
+ f" kwargs: {kwargs}"
+ f" text: '{self.text()}'"
+ f" detailed text: '{self.detailedText()}'",
pytrace=False,
lambda self, *args, **kwargs: (
QMessageBox.Ok
if (
"The backend has encountered warning(s)" in self.text()
and "InstrumentDonor will only be used if GroupingFilename is in XML format." in self.detailedText()
)
else pytest.fail(
"unexpected QMessageBox.exec:"
+ f" args: {args}"
+ f" kwargs: {kwargs}"
+ f" text: '{self.text()}'"
+ f" detailed text: '{self.detailedText()}'",
pytrace=False,
)
),
)
self._logWarningsMessageBox.start()
Expand Down
41 changes: 24 additions & 17 deletions tests/integration/test_workflow_panels_happy_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ def _setup_gui(self, qapp):
self.workflowState = {}
self._warningMessageBox = mock.patch(
"qtpy.QtWidgets.QMessageBox.warning",
lambda *args, **kwargs: pytest.fail(
"WARNING This test seems to be missing expected calibration and/or normalization data", pytrace=False
)
if "Reduction is missing calibration data," in args[2]
else pytest.fail("WARNING messagebox:\n" + f" args: {args}\n" + f" kwargs: {kwargs}", pytrace=False),
lambda *args, **kwargs: (
pytest.fail(
"WARNING This test seems to be missing expected calibration and/or normalization data",
pytrace=False,
)
if "Reduction is missing calibration data," in args[2]
else pytest.fail(
"WARNING messagebox:\n" + f" args: {args}\n" + f" kwargs: {kwargs}", pytrace=False
)
),
)
self._warningMessageBox.start()

Expand All @@ -68,18 +73,20 @@ def _setup_gui(self, qapp):
# patch log-warnings QMessage box: runs using `QMessageBox.exec`.
self._logWarningsMessageBox = mock.patch(
"qtpy.QtWidgets.QMessageBox.exec",
lambda self, *args, **kwargs: QMessageBox.Ok
if (
"The backend has encountered warning(s)" in self.text()
and "InstrumentDonor will only be used if GroupingFilename is in XML format." in self.detailedText()
)
else pytest.fail(
"unexpected QMessageBox.exec:"
+ f" args: {args}"
+ f" kwargs: {kwargs}"
+ f" text: '{self.text()}'"
+ f" detailed text: '{self.detailedText()}'",
pytrace=False,
lambda self, *args, **kwargs: (
QMessageBox.Ok
if (
"The backend has encountered warning(s)" in self.text()
and "InstrumentDonor will only be used if GroupingFilename is in XML format." in self.detailedText()
)
else pytest.fail(
"unexpected QMessageBox.exec:"
+ f" args: {args}"
+ f" kwargs: {kwargs}"
+ f" text: '{self.text()}'"
+ f" detailed text: '{self.detailedText()}'",
pytrace=False,
)
),
)
self._logWarningsMessageBox.start()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/backend/api/test_InterfaceController.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def orchestrateRecipe_side_effect(request): # noqa: ARG001
mockService = mock.Mock()
mockService.orchestrateRecipe.side_effect = orchestrateRecipe_side_effect

interfaceController.serviceFactory.getService.side_effect = (
lambda x: mockService if x == "Test Service" else None
interfaceController.serviceFactory.getService.side_effect = lambda x: (
mockService if x == "Test Service" else None
)
return interfaceController

Expand Down
Loading
Loading