def test_TaurusValueCombobox(qtbot, model, names, value, expected): """Check that the TaurusValueComboBox is started with the right display See https://github.com/taurus-org/taurus/pull/1032 """ a = taurus.Attribute(model) a.write(value) w = TaurusValueComboBox() qtbot.addWidget(w) # ---------------------------------- # workaround: avoid PySide2 segfaults when adding quantity to combobox # https://bugreports.qt.io/browse/PYSIDE-683 if isinstance(value, UR.Quantity) and PYSIDE2: pytest.skip("avoid segfault due to PYSIDE-683 bug") # ---------------------------------- w.addValueNames(names) qtbot.wait_until(lambda: w.count() == len(names), timeout=3200) try: with qtbot.waitSignal(w.valueChangedSignal, timeout=3200): w.setModel(model) assert w.currentText() == expected finally: del a # set model to None as an attempt to avoid problems in atexit() with qtbot.waitSignal(w.valueChangedSignal, timeout=3200): w.setModel(None)