| 303 | |
| 304 | |
| 305 | def _get_testable_qt_backends(): |
| 306 | envs = [] |
| 307 | for deps, env in [ |
| 308 | ([qt_api], {"MPLBACKEND": "qtagg", "QT_API": qt_api}) |
| 309 | for qt_api in ["PyQt6", "PySide6", "PyQt5", "PySide2"] |
| 310 | ]: |
| 311 | reason = None |
| 312 | missing = [dep for dep in deps if not importlib.util.find_spec(dep)] |
| 313 | if (sys.platform == "linux" and |
| 314 | not _c_internal_utils.display_is_valid()): |
| 315 | reason = "$DISPLAY and $WAYLAND_DISPLAY are unset" |
| 316 | elif missing: |
| 317 | reason = "{} cannot be imported".format(", ".join(missing)) |
| 318 | elif env["MPLBACKEND"] == 'macosx' and os.environ.get('TF_BUILD'): |
| 319 | reason = "macosx backend fails on Azure" |
| 320 | marks = [] |
| 321 | if reason: |
| 322 | marks.append(pytest.mark.skip( |
| 323 | reason=f"Skipping {env} because {reason}")) |
| 324 | envs.append(pytest.param(env, marks=marks, id=str(env))) |
| 325 | return envs |
| 326 | |
| 327 | |
| 328 | @pytest.mark.backend('QtAgg', skip_on_importerror=True) |