Commit 68c149f9 authored by Thibault Saunier's avatar Thibault Saunier

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)
parent 748369ff
......@@ -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/",
......
......@@ -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)
......
......@@ -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")
......
......@@ -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(
......
......@@ -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)
......
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment