[pitivi] tests: Remove unused class and rename methods
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] tests: Remove unused class and rename methods
- Date: Sat, 30 Apr 2016 16:04:57 +0000 (UTC)
commit 82279a7cff1dc28f0d1de4d5a97986927067dae7
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Apr 26 22:48:33 2016 +0200
tests: Remove unused class and rename methods
Differential Revision: https://phabricator.freedesktop.org/D967
tests/common.py | 40 ++------------------------------------
tests/test_media_library.py | 6 ++--
tests/test_previewers.py | 2 +-
tests/test_project.py | 8 +++---
tests/test_timeline_layer.py | 2 +-
tests/test_timeline_timeline.py | 2 +-
tests/test_undo_project.py | 2 +-
tests/test_undo_timeline.py | 6 ++--
tests/test_utils_timeline.py | 4 +-
9 files changed, 19 insertions(+), 53 deletions(-)
---
diff --git a/tests/common.py b/tests/common.py
index bec78a4..9ec03b0 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -227,13 +227,13 @@ class TestCase(unittest.TestCase, Loggable):
return xges_path, Gst.filename_to_uri(xges_path)
-def getSampleUri(sample):
+def get_sample_uri(sample):
assets_dir = os.path.dirname(os.path.abspath(__file__))
return "file://%s" % os.path.join(assets_dir, "samples", sample)
-def cleanProxySamples():
+def clean_proxy_samples():
_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "samples")
proxy_manager = ProxyManager(mock.MagicMock())
@@ -242,41 +242,7 @@ def cleanProxySamples():
f = os.path.join(_dir, f)
os.remove(f)
-
-class SignalMonitor(object):
-
- def __init__(self, obj, *signals):
- self.signals = signals
- self.connectToObj(obj)
-
- def connectToObj(self, obj):
- self.obj = obj
- for signal in self.signals:
- obj.connect(signal, self._signalCb, signal)
- setattr(self, self._getSignalCounterName(signal), 0)
- setattr(self, self._getSignalCollectName(signal), [])
-
- def disconnectFromObj(self, obj):
- obj.disconnect_by_func(self._signalCb)
- del self.obj
-
- def _getSignalCounterName(self, signal):
- field = '%s_count' % signal.replace('-', '_')
- return field
-
- def _getSignalCollectName(self, signal):
- field = '%s_collect' % signal.replace('-', '_')
- return field
-
- def _signalCb(self, obj, *args):
- name = args[-1]
- field = self._getSignalCounterName(name)
- setattr(self, field, getattr(self, field, 0) + 1)
- field = self._getSignalCollectName(name)
- setattr(self, field, getattr(self, field, []) + [args[:-1]])
-
-
-def createTestClip(clip_type):
+def create_test_clip(clip_type):
clip = clip_type()
clip.selected = Selected()
diff --git a/tests/test_media_library.py b/tests/test_media_library.py
index 0af7a43..24d2be0 100644
--- a/tests/test_media_library.py
+++ b/tests/test_media_library.py
@@ -94,7 +94,7 @@ class TestMediaLibrary(common.TestCase):
self.samples = samples
for sample_name in samples:
self.app.project_manager.current_project.create_asset(
- common.getSampleUri(sample_name), GES.UriClip,)
+ common.get_sample_uri(sample_name), GES.UriClip,)
def runCheckImport(self, assets, proxying_strategy=ProxyingStrategy.ALL,
check_no_transcoding=False, clean_proxies=True):
@@ -107,7 +107,7 @@ class TestMediaLibrary(common.TestCase):
"notify::fraction", self._progressBarCb)
if clean_proxies:
- common.cleanProxySamples()
+ common.clean_proxy_samples()
self._createAssets(assets)
self.mainloop.run()
@@ -117,7 +117,7 @@ class TestMediaLibrary(common.TestCase):
sample_name = "30fps_numeroted_frames_red.mkv"
self.runCheckImport([sample_name])
- asset_uri = common.getSampleUri(sample_name)
+ asset_uri = common.get_sample_uri(sample_name)
proxy = self.medialibrary.storemodel[0][medialibrary.COL_ASSET]
self.assertEqual(proxy.props.proxy_target.props.id, asset_uri)
diff --git a/tests/test_previewers.py b/tests/test_previewers.py
index a2cb51a..1173048 100644
--- a/tests/test_previewers.py
+++ b/tests/test_previewers.py
@@ -43,7 +43,7 @@ class TestPreviewers(common.TestCase):
sample_name = "1sec_simpsons_trailer.mp4"
testmedialib.runCheckImport([sample_name])
- sample_uri = common.getSampleUri(sample_name)
+ sample_uri = common.get_sample_uri(sample_name)
asset = GES.UriClipAsset.request_sync(sample_uri)
thumb_cache = getThumbnailCache(asset)
diff --git a/tests/test_project.py b/tests/test_project.py
index 1a4fdb0..1a130bf 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -359,7 +359,7 @@ class TestProjectLoading(common.TestCase):
proxy_manager.connect("proxy-ready", proxy_ready_cb)
- uris = [common.getSampleUri("tears_of_steel.webm")]
+ uris = [common.get_sample_uri("tears_of_steel.webm")]
project.addUris(uris)
mainloop.run()
@@ -390,9 +390,9 @@ class TestProjectSettings(common.TestCase):
def testInitialization(self):
mainloop = common.create_main_loop()
uris = collections.deque([
- common.getSampleUri("flat_colour1_640x480.png"),
- common.getSampleUri("tears_of_steel.webm"),
- common.getSampleUri("1sec_simpsons_trailer.mp4")])
+ common.get_sample_uri("flat_colour1_640x480.png"),
+ common.get_sample_uri("tears_of_steel.webm"),
+ common.get_sample_uri("1sec_simpsons_trailer.mp4")])
def loaded_cb(project, timeline):
project.addUris([uris.popleft()])
diff --git a/tests/test_timeline_layer.py b/tests/test_timeline_layer.py
index 30be362..db728d0 100644
--- a/tests/test_timeline_layer.py
+++ b/tests/test_timeline_layer.py
@@ -44,7 +44,7 @@ class TestLayer(common.TestCase):
def testCheckMediaTypesWhenNoUI(self):
ges_layer = GES.Layer()
- png = common.getSampleUri("flat_colour1_640x480.png")
+ png = common.get_sample_uri("flat_colour1_640x480.png")
video_clip = GES.UriClipAsset.request_sync(png).extract()
self.assertTrue(ges_layer.add_clip(video_clip))
self.assertEqual(len(ges_layer.get_clips()), 1)
diff --git a/tests/test_timeline_timeline.py b/tests/test_timeline_timeline.py
index 29e0717..c1519a7 100644
--- a/tests/test_timeline_timeline.py
+++ b/tests/test_timeline_timeline.py
@@ -55,7 +55,7 @@ class BaseTestTimeline(common.TestCase):
layer = timeline.ges_timeline.append_layer()
asset = GES.UriClipAsset.request_sync(
- common.getSampleUri("tears_of_steel.webm"))
+ common.get_sample_uri("tears_of_steel.webm"))
clips = [layer.add_asset(asset, i * 10, 0, 10, GES.TrackType.UNKNOWN)
for i in range(num_clips)]
diff --git a/tests/test_undo_project.py b/tests/test_undo_project.py
index 5f3dedf..02a04cf 100644
--- a/tests/test_undo_project.py
+++ b/tests/test_undo_project.py
@@ -59,7 +59,7 @@ class TestProjectUndo(TestCase):
self.action_log.connect("commit", commit_cb)
def loaded_cb(unused_project, unused_timeline):
- uris = [common.getSampleUri("tears_of_steel.webm")]
+ uris = [common.get_sample_uri("tears_of_steel.webm")]
self.project.addUris(uris)
self.project.connect_after("loaded", loaded_cb)
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 1607e4f..87a7be8 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -153,7 +153,7 @@ class TestTimelineUndo(TestCase):
self.assertEqual(self.timeline.get_layers(), [layer2, layer3, layer1])
def testControlSourceValueAdded(self):
- uri = common.getSampleUri("tears_of_steel.webm")
+ uri = common.get_sample_uri("tears_of_steel.webm")
asset = GES.UriClipAsset.request_sync(uri)
clip = asset.extract()
self.layer.add_clip(clip)
@@ -177,7 +177,7 @@ class TestTimelineUndo(TestCase):
self.assertEqual(0.2, keyframes[0].value)
def testControlSourceValueRemoved(self):
- uri = common.getSampleUri("tears_of_steel.webm")
+ uri = common.get_sample_uri("tears_of_steel.webm")
asset = GES.UriClipAsset.request_sync(uri)
clip = asset.extract()
self.layer.add_clip(clip)
@@ -397,7 +397,7 @@ class TestTimelineUndo(TestCase):
self.assertEqual(20, clip1.get_priority())
def testUngroup(self):
- uri = common.getSampleUri("tears_of_steel.webm")
+ uri = common.get_sample_uri("tears_of_steel.webm")
asset = GES.UriClipAsset.request_sync(uri)
clip1 = asset.extract()
self.layer.add_clip(clip1)
diff --git a/tests/test_utils_timeline.py b/tests/test_utils_timeline.py
index 1f2f205..93caf11 100644
--- a/tests/test_utils_timeline.py
+++ b/tests/test_utils_timeline.py
@@ -57,8 +57,8 @@ class TestSelection(TestCase):
def testGetSingleClip(self):
selection = Selection()
- clip1 = common.createTestClip(GES.UriClip)
- clip2 = common.createTestClip(GES.TitleClip)
+ clip1 = common.create_test_clip(GES.UriClip)
+ clip2 = common.create_test_clip(GES.TitleClip)
# Selection empty.
self.assertFalse(selection.getSingleClip(GES.TitleClip))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]