From 01df945e0215410e66c93d174af8d70cd125596e Mon Sep 17 00:00:00 2001 From: Emmanuel Arias Date: Wed, 6 Jul 2022 18:10:50 -0300 Subject: [PATCH] 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 Gbp-Pq: Name 0004-Use-context-manager-to-avoid-error-in-test.patch --- test/test_xlib_display.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_xlib_display.py b/test/test_xlib_display.py index 6199461..23c0514 100644 --- a/test/test_xlib_display.py +++ b/test/test_xlib_display.py @@ -52,8 +52,9 @@ class TestXlibDisplay(unittest.TestCase): 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))