[pitivi] tests: Make some fatal GLib logs failures
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tests: Make some fatal GLib logs failures
- Date: Sat, 21 Jul 2018 00:02:35 +0000 (UTC)
commit 68c149f9eb81b61b7a1d48bbc84f8f7b6837e75b
Author: Thibault Saunier <tsaunier igalia com>
Date: Sun Jul 1 14:39:57 2018 -0400
tests: Make some fatal GLib logs failures
Not simply using fatal-criticals as some criticals are outside of
control on the CI server (no dbus running there)
build/flatpak/pitivi-flatpak | 3 ++-
pitivi/application.py | 8 +++++++-
tests/common.py | 13 +++++++++++++
tests/ptv_testsuite.py | 5 +++--
tests/test_editorperspective.py | 6 ++----
tests/test_pipeline.py | 2 +-
6 files changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/build/flatpak/pitivi-flatpak b/build/flatpak/pitivi-flatpak
index c302c8d9..aecb56b2 100755
--- a/build/flatpak/pitivi-flatpak
+++ b/build/flatpak/pitivi-flatpak
@@ -564,7 +564,8 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
if not args:
return
- flatpak_command = ["flatpak", "build", "--socket=x11",
+ flatpak_command = ["flatpak", "build", "--socket=x11", "--socket=wayland",
+ "--talk-name=org.freedesktop.Flatpak",
"--socket=session-bus", "--socket=pulseaudio",
"--share=network", "--env=PITIVI_DEVELOPMENT=1",
"--env=PYTHONUSERBASE=/app/",
diff --git a/pitivi/application.py b/pitivi/application.py
index 1713c9f4..25317659 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -23,6 +23,7 @@ import time
from gettext import gettext as _
from gi.repository import Gio
+from gi.repository import GLib
from gi.repository import GObject
from gi.repository import Gst
from gi.repository import Gtk
@@ -274,7 +275,12 @@ class Pitivi(Gtk.Application, Loggable):
# We remove the project from recent projects list
# and then re-add it to this list to make sure it
# gets positioned at the top of the recent projects list.
- self.recent_manager.remove_item(uri)
+ try:
+ self.recent_manager.remove_item(uri)
+ except GLib.Error as e:
+ if e.domain != "gtk-recent-manager-error-quark":
+ raise e
+ pass
self.recent_manager.add_item(uri)
self.action_log = UndoableActionLog()
self.action_log.connect("pre-push", self._action_log_pre_push_cb)
diff --git a/tests/common.py b/tests/common.py
index 070e51ec..704270b1 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -58,6 +58,19 @@ def handle_uncaught_exception(exctype, value, trace):
sys.excepthook = handle_uncaught_exception
+
+def handle_glog(domain, level, message, udata):
+ Gst.debug_print_stack_trace()
+ traceback.print_stack()
+ print("%s - %s" % (domain, message), file=sys.stderr)
+ sys.exit(-11)
+
+
+# GStreamer Not enabled because of an assertion on caps on the CI server.
+# See https://gitlab.gnome.org/thiblahute/pitivi/-/jobs/66570
+for category in ["Gtk", "Gdk", "GLib-GObject", "GES"]:
+ GLib.log_set_handler(category, GLib.LogLevelFlags.LEVEL_CRITICAL, handle_glog, None)
+
detect_leaks = os.environ.get("PITIVI_TEST_DETECT_LEAKS", "0") not in ("0", "")
os.environ["PITIVI_USER_CACHE_DIR"] = tempfile.mkdtemp(suffix="pitiviTestsuite")
diff --git a/tests/ptv_testsuite.py b/tests/ptv_testsuite.py
index 211b669b..3577f34c 100644
--- a/tests/ptv_testsuite.py
+++ b/tests/ptv_testsuite.py
@@ -47,8 +47,9 @@ def setup_tests(test_manager, options):
testsuites = loader.discover(CDIR)
for testsuite in testsuites:
for _tests in testsuite:
- if isinstance(_tests, unittest.loader._FailedTest):
- print(_tests._exception)
+
+ if isinstance(_tests, unittest.loader._FailedTest): # pylint: disable=protected-access
+ print(_tests._exception) # pylint: disable=protected-access
continue
for test in _tests:
test_manager.add_test(PitiviTest(
diff --git a/tests/test_editorperspective.py b/tests/test_editorperspective.py
index 239ae9b3..76d5e132 100644
--- a/tests/test_editorperspective.py
+++ b/tests/test_editorperspective.py
@@ -59,6 +59,8 @@ class TestEditorPerspective(common.TestCase):
editorperspective = EditorPerspective(app)
editorperspective.setup_ui()
editorperspective.viewer = mock.MagicMock()
+ editorperspective.medialibrary._import_warning_infobar = mock.MagicMock()
+ editorperspective.clipconfig.effect_expander._infobar = mock.MagicMock()
def __pm_missing_uri_cb(project_manager, project, error, asset):
nonlocal mainloop
@@ -75,7 +77,6 @@ class TestEditorPerspective(common.TestCase):
dialog.get_new_uri.return_value = None
# Call the actual callback
- # pylint: disable=protected-access
app.proxy_manager.checkProxyLoadingSucceeded = \
mock.MagicMock(return_value=has_proxy)
@@ -86,13 +87,10 @@ class TestEditorPerspective(common.TestCase):
self.assertTrue(dialog.get_new_uri.called)
self.assertEqual(failed_cb.called, not has_proxy)
- # pylint: disable=protected-access
app.project_manager.connect("missing-uri",
editorperspective._projectManagerMissingUriCb)
-
mainloop.quit()
- # pylint: disable=protected-access
disconnectAllByFunc(app.project_manager,
editorperspective._projectManagerMissingUriCb)
diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py
index 7cd15a7d..e9d44255 100644
--- a/tests/test_pipeline.py
+++ b/tests/test_pipeline.py
@@ -75,7 +75,7 @@ class TestPipeline(common.TestCase):
def test_async_done_not_received(self):
"""Checks the recovery when the ASYNC_DONE message timed out."""
- ges_timeline = GES.Timeline()
+ ges_timeline = GES.Timeline.new()
self.assertTrue(ges_timeline.add_track(GES.VideoTrack.new()))
ges_layer = ges_timeline.append_layer()
uri = common.get_sample_uri("tears_of_steel.webm")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]