From 72067bb5a6d92564284f5a6a94369f24cd4405bb Mon Sep 17 00:00:00 2001 From: Sean Vig Date: Tue, 6 Sep 2016 22:38:14 -0700 Subject: Fix XCB tests Make sure XCB objects are free'd, and cffi objects set to None so they are gc'd and destroyed before the connection is disconnected. Origin: https://github.com/Kozea/cairocffi/pull/68 Bug-Debian: https://bugs.debian.org/828929 Patch-Name: fix-xcb-tests.patch --- cairocffi/test_xcb.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cairocffi/test_xcb.py b/cairocffi/test_xcb.py index c8a6e70..1aa5123 100644 --- a/cairocffi/test_xcb.py +++ b/cairocffi/test_xcb.py @@ -87,6 +87,10 @@ def create_pixmap(conn, wid, width, height): return pixmap +def remove_pixmap(conn, pixmap): + conn.core.FreePixmap(pixmap) + + def create_gc(conn): """Creates a simple graphics context""" gc = conn.generate_id() @@ -104,8 +108,10 @@ def create_gc(conn): return gc -@pytest.mark.xfail(cairo_version() < 11200, - reason="Cairo version too low") +def remove_gc(conn, gc): + conn.core.FreeGC(gc) + + def test_xcb_pixmap(xcb_conn): width = 10 height = 10 @@ -149,6 +155,11 @@ def test_xcb_pixmap(xcb_conn): width, height ) + ctx = None + surface = None + remove_gc(xcb_conn, gc) + remove_pixmap(xcb_conn, pixmap) + # flush the connection, make sure no errors were thrown xcb_conn.flush() while event: @@ -220,6 +231,9 @@ def test_xcb_window(xcb_conn): ctx.set_source_rgb(1, 1, 1) ctx.paint() + ctx = None + surface = None + # flush the connection, make sure no errors were thrown xcb_conn.flush() while event: