python-xlib/debian/patches/0004-Use-context-manager-to...

30 lines
1.2 KiB
Diff

From: Emmanuel Arias <eamanu@yaerobi.com>
Date: Wed, 6 Jul 2022 18:10:50 -0300
Subject: Use context manager to avoid error in test.
Use context manager in tests to avoid an error during the Build in
Debian.
Forwarded: https://github.com/python-xlib/python-xlib/issues/231
Bug-Debian: https://bugs.debian.org/1006033
---
test/test_xlib_display.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: python-xlib/test/test_xlib_display.py
===================================================================
--- python-xlib.orig/test/test_xlib_display.py 2022-12-30 22:10:10.388738608 -0300
+++ python-xlib/test/test_xlib_display.py 2022-12-30 22:10:33.357010879 -0300
@@ -52,8 +52,9 @@
self.assertEqual(str(self.display.display.socket_error), "Display connection closed by client")
def test_can_close_display_and_check_for_error(self):
- self.display.close()
- self.assertRaises(Xlib.error.ConnectionClosedError, self.display.flush)
+ with self.assertRaises(Xlib.error.ConnectionClosedError):
+ self.display.close()
+ self.display.flush()
def test_return_fileno(self):
self.assertTrue(isinstance(self.display.fileno(), int))