test/pyxtest: catch OSError when closing Xlib display

Avoid a blind Exception catch around display.close() (ruff BLE001/S110).

Assisted-by: AI
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2265>
This commit is contained in:
Olivier Fourdan 2026-07-29 10:07:19 +02:00
commit 28a7f67f56

View file

@ -574,7 +574,8 @@ class XlibConnection:
def close(self):
try:
self.display.close()
except Exception:
except OSError:
# Display may already be closed (e.g. server gone).
pass
def __enter__(self) -> Self: