After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 693377 - [Patch] realized context-manager for widget tests
[Patch] realized context-manager for widget tests
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-02-07 22:52 UTC by Christoph Reiter (lazka)
Modified: 2013-02-11 09:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (4.99 KB, patch)
2013-02-07 22:52 UTC, Christoph Reiter (lazka)
reviewed Details | Review
patch-v2 (4.84 KB, patch)
2013-02-11 07:57 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Christoph Reiter (lazka) 2013-02-07 22:52:26 UTC
Created attachment 235460 [details] [review]
patch

I got some random warnings during the test run...

(not sure if this is the right approach..)

The attached patch introduces a context manager that puts the widget in a window and does main loop iterations until the widget is realized and reverts everything afterwards.

The test suite fails anyway without X, so I guess this is OK for now.
I haven't tested with py3k.. but as far as I see it should work.
Comment 1 Simon Feltman 2013-02-09 08:57:30 UTC
Review of attachment 235460 [details] [review]:

I like the idea. Minimally it consolidates the hack into a common re-usable location. It also makes me think we should add an override for GLib.log_set_always_fatal to return a context manager but can still be used as a regular function. Please have a look at: https://live.gnome.org/GnomeLove/SubmittingPatches
and add a description. It would also be nice if we didn't have to show the window if that is a possibility? Thanks!
Comment 2 Christoph Reiter (lazka) 2013-02-11 07:57:00 UTC
Created attachment 235681 [details] [review]
patch-v2

without showing windows
Comment 3 Martin Pitt 2013-02-11 09:08:38 UTC
Comment on attachment 235681 [details] [review]
patch-v2

Very nice, thank you! Pushed with a fixed docstring.