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
This commit is contained in:
Emmanuel Arias 2022-07-06 18:10:50 -03:00 committed by luoyaoming
parent 193704df97
commit 01df945e02
1 changed files with 3 additions and 2 deletions

View File

@ -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))