Show More
@@ -33,18 +33,18 b' _get_qt_vers()' | |||||
33 | len(guis_avail) == 0, reason="No viable version of PyQt or PySide installed." |
|
33 | len(guis_avail) == 0, reason="No viable version of PyQt or PySide installed." | |
34 | ) |
|
34 | ) | |
35 | def test_inputhook_qt(): |
|
35 | def test_inputhook_qt(): | |
36 | gui = guis_avail[0] |
|
36 | # Choose the "best" Qt version. | |
37 |
|
37 | gui_ret, _ = get_inputhook_name_and_func('qt') | ||
38 | # Choose a qt version and get the input hook function. This will import Qt... |
|
38 | ||
39 | get_inputhook_name_and_func(gui) |
|
39 | assert gui_ret != "qt" # you get back the specific version that was loaded. | |
40 |
|
40 | assert gui_ret in guis_avail | ||
41 | # ...and now we're stuck with this version of Qt for good; can't switch. |
|
41 | ||
42 | for not_gui in ["qt6", "qt5"]: |
|
42 | if len(guis_avail) > 2: | |
43 | if not_gui not in guis_avail: |
|
43 | # ...and now we're stuck with this version of Qt for good; can't switch. | |
44 | break |
|
44 | for not_gui in ["qt6", "qt5"]: | |
45 |
|
45 | if not_gui != gui_ret: | ||
46 | with pytest.raises(ImportError): |
|
46 | break | |
47 | get_inputhook_name_and_func(not_gui) |
|
47 | # Try to import the other gui; it won't work. | |
48 |
|
48 | gui_ret2, _ = get_inputhook_name_and_func(not_gui) | ||
49 | # A gui of 'qt' means "best available", or in this case, the last one that was used. |
|
49 | assert gui_ret2 == gui_ret | |
50 | get_inputhook_name_and_func("qt") |
|
50 | assert gui_ret2 != not_gui |
General Comments 0
You need to be logged in to leave comments.
Login now