File: 0004-Use-context-manager-to-avoid-error-in-test.patch

package info (click to toggle)
python-xlib 0.33-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,040 kB
  • sloc: python: 23,022; awk: 89; makefile: 60; sh: 10
file content (29 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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))