[pitivi] Fix the testsuite



commit dc9c07f666f8ccb53c0972e69569cf0cf5bb3c5b
Author: Thibault Saunier <tsaunier gnome org>
Date:   Sat Sep 27 23:14:24 2014 +0200

    Fix the testsuite
    
    Minor changes around to fix the testsuite
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739251

 pitivi/project.py           |    3 ++-
 pitivi/undo/undo.py         |   12 ++++++++----
 tests/test_undo_timeline.py |    9 ++++-----
 tests/test_utils.py         |    8 --------
 4 files changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/pitivi/project.py b/pitivi/project.py
index bd31804..a5671cd 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -972,9 +972,10 @@ class Project(Loggable, GES.Project):
         """
         # In this extract call the project is loaded from the file.
         self.timeline = self.extract()
-        self.timeline.commit = self._commit
         if self.timeline is None:
             return False
+
+        self.timeline.commit = self._commit
         if not self.timeline.get_layers():
             self.timeline.props.auto_transition = True
         self._calculateNbLoadingAssets()
diff --git a/pitivi/undo/undo.py b/pitivi/undo/undo.py
index 1dd8c22..28e7ce2 100644
--- a/pitivi/undo/undo.py
+++ b/pitivi/undo/undo.py
@@ -141,7 +141,10 @@ class UndoableActionLog(GObject.Object, Loggable):
         GObject.Object.__init__(self)
         Loggable.__init__(self)
 
-        self.app = weakref.proxy(app)
+        if app is not None:
+            self.app = weakref.proxy(app)
+        else:
+            self.app = None
         self.undo_stacks = []
         self.redo_stacks = []
         self.stacks = []
@@ -165,9 +168,10 @@ class UndoableActionLog(GObject.Object, Loggable):
         self.debug("Pushing %s", action)
 
         try:
-            st = action.serializeLastAction()
-            if self.app is not None and st is not None:
-                self.app.write_action(st)
+            if action is not None:
+                st = action.serializeLastAction()
+                if self.app is not None and st is not None:
+                    self.app.write_action(st)
         except NotImplementedError:
             self.warning("No serialization method for that action")
 
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 0d6aac4..9118c45 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -29,8 +29,7 @@ from tests import common
 
 from pitivi.undo.timeline import TimelineLogObserver, \
     ClipAdded, ClipRemoved, \
-    ClipPropertyChanged, EffectAdded
-from pitivi.undo.effect import EffectPropertyChanged
+    ClipPropertyChanged, TrackElementAdded
 from pitivi.undo.undo import UndoableActionLog
 
 
@@ -181,7 +180,7 @@ class TestTimelineUndo(TestCase):
         stack = stacks[0]
         self.assertEqual(1, len(stack.done_actions), stack.done_actions)
         action = stack.done_actions[0]
-        self.assertTrue(isinstance(action, EffectAdded))
+        self.assertTrue(isinstance(action, TrackElementAdded))
 
         self.assertTrue(effect1 in clip1.get_children(True))
         self.assertEqual(1, len([effect for effect in
@@ -212,7 +211,7 @@ class TestTimelineUndo(TestCase):
         stack = stacks[0]
         self.assertEqual(1, len(stack.done_actions), stack.done_actions)
         action = stack.done_actions[0]
-        self.assertTrue(isinstance(action, EffectAdded))
+        self.assertTrue(isinstance(action, TrackElementAdded))
 
         self.assertTrue(effect1 in clip1.get_children(True))
         self.assertEqual(1, len([effect for effect in
@@ -253,7 +252,7 @@ class TestTimelineUndo(TestCase):
         stack = stacks[0]
         self.assertEqual(1, len(stack.done_actions), stack.done_actions)
         action = stack.done_actions[0]
-        self.assertTrue(isinstance(action, EffectAdded))
+        self.assertTrue(isinstance(action, TrackElementAdded))
 
         self.assertTrue(effect1 in clip1.get_children(True))
         self.assertEqual(1, len([effect for effect in
diff --git a/tests/test_utils.py b/tests/test_utils.py
index d3ca94b..9ecfb16 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -89,11 +89,3 @@ class TestDependencyChecks(TestCase):
         classic_dep = ClassicDependency("numpy", None)
         classic_dep.check()
         self.assertTrue(classic_dep.satisfied)
-
-        gst_plugin_dep = GstPluginDependency("gnonlin", "1.1.90")
-        gst_plugin_dep.check()
-        self.assertTrue(gst_plugin_dep.satisfied)
-
-        gst_plugin_dep = GstPluginDependency("gnonlin", "9.9.9")
-        gst_plugin_dep.check()
-        self.assertFalse(gst_plugin_dep.satisfied)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]