GNOME Bugzilla – Bug 751156
Silence various build and test warnings
Last modified: 2015-07-02 18:52:20 UTC
The build and test process is getting quite noisy with current jhbuild trunk, so here are some patches to improve this situation. Related issues in other projects: bug 751140 and bug 751150
Created attachment 305557 [details] [review] Fix gcc warning regarding uninitialized use of variable Fix gcc warning regarding uninitialized use of variable
Created attachment 305558 [details] [review] tests: Silence various error messages and warnings. This silences glib warnings which are due to testing of error handling, deprecation warnings which we ignore since we want to continue testing deprecated code and other error output of code which is supposed to fail. To reduce code duplication and make things easier this introduces a shared helper module containing various context managers and decorators which allow testing and silencing of warnings and errors.
Review of attachment 305558 [details] [review]: Looks good overall, just a few nitpicks. ::: tests/helper.py @@ +19,3 @@ + +@contextlib.contextmanager +def capture_exceptions(): We might want to think about using this in test_generictreemodel.py [1] in the future. Your implementation is simpler which I like. [1] https://git.gnome.org/browse/pygobject/tree/tests/test_generictreemodel.py?id=3.16.2#n316 @@ +37,3 @@ + + +def test_ignore_gi_deprecation_warnings(func_or_class): I don't really like the "test_" prefix here. What about just naming it ignore_gi_deprecation_warnings() ? ::: tests/test_everything.py @@ +628,3 @@ # through from the callback, as it crosses the Python<->C boundary # twice. (See GNOME #616279) + with capture_exceptions() as esc: Any reason this is named "esc" instead of "exc" as used elsewhere in your patch?
Review of attachment 305557 [details] [review]: Sure.
(In reply to Simon Feltman from comment #3) > Review of attachment 305558 [details] [review] [review]: > > Looks good overall, just a few nitpicks. > > ::: tests/helper.py > @@ +19,3 @@ > + > +@contextlib.contextmanager > +def capture_exceptions(): > > We might want to think about using this in test_generictreemodel.py [1] in > the future. Your implementation is simpler which I like. > > [1] > https://git.gnome.org/browse/pygobject/tree/tests/test_generictreemodel. > py?id=3.16.2#n316 Sounds good. (I didn't include this in the updated patch) > @@ +37,3 @@ > + > + > +def test_ignore_gi_deprecation_warnings(func_or_class): > > I don't really like the "test_" prefix here. What about just naming it > ignore_gi_deprecation_warnings() ? OK > ::: tests/test_everything.py > @@ +628,3 @@ > # through from the callback, as it crosses the Python<->C boundary > # twice. (See GNOME #616279) > + with capture_exceptions() as esc: > > Any reason this is named "esc" instead of "exc" as used elsewhere in your > patch? No, just a typo/thinko.
Created attachment 306645 [details] [review] tests: Silence various error messages and warnings.
Review of attachment 306645 [details] [review]: Unittest output is a lot cleaner now, thanks!
https://git.gnome.org/browse/pygobject/commit/?id=619777730891b42b98da556c3aa9ca5a1b3f617b https://git.gnome.org/browse/pygobject/commit/?id=fea15145c2a3e6aac73350241a982a095e16c7d8