Skip to content

Commit

Permalink
Merge pull request #436 from ZLLentz/v1.1.6-rel
Browse files Browse the repository at this point in the history
MNT: test suite compatibility with pydm v1.11.0
  • Loading branch information
ZLLentz authored Apr 5, 2021
2 parents 882227d + 293e855 commit 5b1bf61
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
4 changes: 2 additions & 2 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ requirements:
- qdarkstyle
- qtawesome
- qtconsole
- timechart
- timechart >=1.2.4

about:
home: https://github.com/pcdshub/typhos
Expand All @@ -52,4 +52,4 @@ extra:
recipe-maintainers:
- klauer
- hhslepicka
- zllentz
- zllentz
15 changes: 15 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
Release History
=================

v1.1.6 (2021-04-05)
===================

Description
-----------
This is maintenance/compatibility release for pydm v1.11.0.

Compatibility / Fixes
---------------------
- Internal fixes regarding error handling and input sanitization.
Some subtle issues cropped up here in the update to pydm v1.11.0.
- Fix issue where the test suite would freeze when pydm displays
an exception to the user.


v1.1.5 (2020-04-02)
===================

Expand Down
13 changes: 12 additions & 1 deletion typhos/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,14 +834,24 @@ def load_best_template(self):
widget = QtWidgets.QWidget()
template = None
else:
template = pathlib.Path(template)
try:
widget = self._load_template(template)
except Exception as ex:
logger.exception("Unable to load file %r", template)
# If we have a previously defined template
if self._current_template is not None:
# Fallback to it so users have a choice
widget = self._load_template(self._current_template)
try:
widget = self._load_template(self._current_template)
except Exception:
logger.exception(
"Failed to fall back to previous template: %s",
self._current_template
)
template = None
widget = None

pydm.exception.raise_to_operator(ex)
else:
widget = QtWidgets.QWidget()
Expand Down Expand Up @@ -903,6 +913,7 @@ def _get_templates_from_macros(macros):

def _load_template(self, filename):
"""Load template from file and return the widget."""
filename = pathlib.Path(filename)
loader = (pydm.display.load_py_file if filename.suffix == '.py'
else pydm.display.load_ui_file)

Expand Down
4 changes: 4 additions & 0 deletions typhos/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

import pydm
import pytest

import typhos
Expand Down Expand Up @@ -38,6 +39,9 @@ def test_cli_no_entry(monkeypatch, qtbot, happi_cfg):

def test_cli_stylesheet(monkeypatch, qapp, qtbot, happi_cfg):
monkeypatch.setattr(QApplication, 'exec_', lambda x: 1)
monkeypatch.setattr(
pydm.exception, 'raise_to_operator', lambda *_, **__: None
)
with open('test.qss', 'w+') as handle:
handle.write(
"TyphosDeviceDisplay {qproperty-force_template: 'test.ui'}")
Expand Down

0 comments on commit 5b1bf61

Please sign in to comment.