Commit 748369ff authored by Thibault Saunier's avatar Thibault Saunier

tests: Exit whenever an unhandled backtrace happens

And fix all tests.

Fixes #2207
parent a6511c1e
......@@ -997,7 +997,7 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
faked = self.pipeline.get_by_name("faked")
faked.props.sync = True
self._wavebin = self.pipeline.get_by_name("wave")
asset = self.ges_elem.get_parent().get_asset()
asset = self.ges_elem.get_asset().get_filesource_asset()
self._wavebin.props.uri = asset.get_id()
self._wavebin.props.duration = asset.get_duration()
decode = self.pipeline.get_by_name("decode")
......@@ -1005,7 +1005,6 @@ class AudioPreviewer(Previewer, Zoomable, Loggable):
bus = self.pipeline.get_bus()
bus.add_signal_watch()
asset = self.ges_elem.get_parent().get_asset()
self.n_samples = asset.get_duration() / SAMPLE_DURATION
bus.connect("message", self._busMessageCb)
......
......@@ -23,7 +23,9 @@ import contextlib
import gc
import os
import shutil
import sys
import tempfile
import traceback
import unittest
from unittest import mock
......@@ -47,6 +49,15 @@ from pitivi.utils.proxy import ProxyManager
from pitivi.utils.timeline import Selected
from pitivi.utils.timeline import Zoomable
def handle_uncaught_exception(exctype, value, trace):
traceback.print_tb(trace)
print(value, file=sys.stderr)
sys.exit(1)
sys.excepthook = handle_uncaught_exception
detect_leaks = os.environ.get("PITIVI_TEST_DETECT_LEAKS", "0") not in ("0", "")
os.environ["PITIVI_USER_CACHE_DIR"] = tempfile.mkdtemp(suffix="pitiviTestsuite")
......
......@@ -219,7 +219,8 @@ class TestMediaLibrary(BaseTestMediaLibrary):
def test_supported_out_of_container_audio(self):
sample = "mp3_sample.mp3"
with common.cloned_sample(sample):
self.check_import([sample], check_no_transcoding=True)
self.check_import([sample], check_no_transcoding=True,
proxying_strategy=ProxyingStrategy.AUTOMATIC)
def test_missing_uri_displayed(self):
with common.cloned_sample():
......
......@@ -62,7 +62,11 @@ class TestProjectManager(common.TestCase):
def setUp(self):
super(TestProjectManager, self).setUp()
app = mock.MagicMock()
self.setupApp()
def setupApp(self, app=None):
if not app:
app = mock.MagicMock()
self.manager = ProjectManager(app)
self.listener = ProjectManagerListener(self.manager)
self.signals = self.listener.signals
......@@ -98,6 +102,7 @@ class TestProjectManager(common.TestCase):
self.assertEqual("new-project-loaded", name, self.signals)
def testMissingUriForwarded(self):
self.setupApp(app=common.create_pitivi_mock())
mainloop = common.create_main_loop()
def missingUriCb(self, project, error, clip_asset, result):
......
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