File: util.py

package info (click to toggle)
taurus-pyqtgraph 0.9.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,284 kB
  • sloc: python: 5,234; makefile: 82
file content (29 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Convenience functions, etc for tests
"""


def show_and_wait(qtbot, *widgets, timeout=60000, raising=False):
    """
    Helper that shows widgets and waits until they are closed (or timeout ms)
    """
    for w in widgets:
        w.show()

    def are_closed():
        for w in widgets:
            if w.isVisible():
                return False
        return True

    try:
        qtbot.wait_until(are_closed, timeout=timeout)
    except AssertionError:
        if raising:
            raise


def get_sub_config(cfg, item):
    assert item in cfg["__itemConfigurations__"]
    assert item in cfg["__orderedConfigNames__"]
    return cfg["__itemConfigurations__"][item]