Hello everybody,

I'm working on the new upstream release 0.31 and I'm looking for this bug [0]. But, I can not reproduce it. If I run in 0.29 and 0.31 the tests finish successfully, but in [1] fails in different archs. Could you reproduce it? Could you give me some
advice/tips/clues about why I cannot reproduce it, please?

Anyway I created this patch, because I suspect that for some reason, the
self.display.flush() is raising the Exception before pytest can catch it, but
I don't think that is possible.

```
From: Emmanuel Arias <eam...@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.

Bug-Debian: https://bugs.debian.org/1006033
---
 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 a41c53b..a2e31f3 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))

```

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1006033
[1] https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/python-xlib.html

Thanks!
Cheers,
Emmanuel

Attachment: OpenPGP_0xFA9DEC5DE11C63F1.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to