diff options
author | Jesús <heckyel@hyperbola.info> | 2020-06-01 20:25:35 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-06-01 20:25:35 -0500 |
commit | 9d221d5af918803180f74cd9fcbf107d38b068de (patch) | |
tree | 9d2b61b17c2a6305e9c62aa6f13e89826bcccfc2 | |
parent | 507463cf0d147415d84990d9fd7eaff4aa6d7bd0 (diff) | |
download | librevideoconverter-9d221d5af918803180f74cd9fcbf107d38b068de.tar.lz librevideoconverter-9d221d5af918803180f74cd9fcbf107d38b068de.tar.xz librevideoconverter-9d221d5af918803180f74cd9fcbf107d38b068de.zip |
fix test
-rw-r--r-- | test/mock.py | 55 | ||||
-rw-r--r-- | test/runtests.py | 10 | ||||
-rw-r--r-- | test/test_conversion.py | 7 | ||||
-rw-r--r-- | test/test_utils.py | 9 | ||||
-rw-r--r-- | test/test_video.py | 7 | ||||
-rw-r--r-- | test/testdata/fake_converter.py | 12 | ||||
-rw-r--r-- | test/uitests.sikuli/config.py | 16 | ||||
-rw-r--r-- | test/uitests.sikuli/datafiles.py | 135 | ||||
-rw-r--r-- | test/uitests.sikuli/lvc_steps.py | 6 | ||||
-rw-r--r-- | test/uitests.sikuli/lvcgui.py | 32 | ||||
-rw-r--r-- | test/uitests.sikuli/readme.md | 2 | ||||
-rw-r--r-- | test/uitests.sikuli/test_android_conversions.py | 6 | ||||
-rw-r--r-- | test/uitests.sikuli/test_apple_conversions.py | 6 | ||||
-rw-r--r-- | test/uitests.sikuli/test_choose_files.py | 1 | ||||
-rw-r--r-- | test/uitests.sikuli/test_clear_finished_conversions.py | 1 | ||||
-rw-r--r-- | test/uitests.sikuli/test_conversions.py | 40 | ||||
-rw-r--r-- | test/uitests.sikuli/test_output_settings.py | 4 | ||||
-rw-r--r-- | test/uitests.sikuli/test_remove_files.py | 7 | ||||
-rw-r--r-- | test/uitests.sikuli/uitests.py | 2 |
19 files changed, 181 insertions, 177 deletions
diff --git a/test/mock.py b/test/mock.py index c31bdf2..46af0d5 100644 --- a/test/mock.py +++ b/test/mock.py @@ -12,9 +12,6 @@ # Scripts maintained at http://www.voidspace.org.uk/python/index.shtml # Comments, suggestions and bug reports welcome. -import pprint -import sys - __all__ = ( 'Mock', 'MagicMock', @@ -31,8 +28,8 @@ __all__ = ( 'PropertyMock', ) - -__version__ = '1.1' +import pprint +import sys try: import inspect @@ -272,7 +269,7 @@ def _set_signature(mock, original, instance=False): src = """def %s(*args, **kwargs): _checksig_(*args, **kwargs) return mock(*args, **kwargs)""" % name - exec (src, context) + exec(src, context) funcopy = context[name] _setup_func(funcopy, mock) return funcopy @@ -470,7 +467,8 @@ class NonCallableMock(Base): def __init__( self, spec=None, wraps=None, name=None, spec_set=None, parent=None, _spec_state=None, _new_name='', _new_parent=None, - **kwargs): + **kwargs + ): if _new_parent is None: _new_parent = parent @@ -748,10 +746,7 @@ class NonCallableMock(Base): if not _is_instance_mock(value): setattr(type(self), name, _get_method(name, value)) original = value - - def value(*args, **kw): - return original(self, *arg, **kw) - # value = lambda *args, **kw: original(self, *args, **kw) + original = lambda *args, **kw: original(self, *args, **kw) else: # only set _new_name and not name so that mock_calls is tracked # but not method calls @@ -1003,8 +998,8 @@ class Mock(CallableMixin, NonCallableMock): * `spec`: This can be either a list of strings or an existing object (a class or instance) that acts as the specification for the mock object. If you pass in an object then a list of strings is formed by calling dir on - the object (excluding unsupported magic attributes and methods). Accessing - any attribute not in this list will raise an `AttributeError`. + the object (excluding unsupported magic attributes and methods). + Accessing any attribute not in this list will raise an `AttributeError`. If `spec` is an object (rather than a list of strings) then `mock.__class__` returns the class of the spec object. This allows mocks @@ -1081,7 +1076,8 @@ class _patch(object): def __init__( self, getter, attribute, new, spec, create, - spec_set, autospec, new_callable, kwargs): + spec_set, autospec, new_callable, kwargs + ): if new_callable is not None: if new is not DEFAULT: raise ValueError( @@ -1366,17 +1362,15 @@ def _get_target(target): except (TypeError, ValueError): raise TypeError("Need a valid target to patch. You supplied: %r" % (target,)) - - def getter(): - return _importer(target) - # getter = lambda: _importer(target) + getter = lambda: _importer(target) return getter, attribute def _patch_object( target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, - new_callable=None, **kwargs): + new_callable=None, **kwargs + ): """ patch.object(target, attribute, new=DEFAULT, spec=None, create=False, spec_set=None, autospec=None, new_callable=None, **kwargs) @@ -1393,10 +1387,7 @@ def _patch_object( When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` for choosing which methods to wrap. """ - - def getter(): - return target - # getter = lambda: target + getter = lambda: target return _patch( getter, attribute, new, spec, create, spec_set, autospec, new_callable, kwargs @@ -1426,15 +1417,9 @@ def _patch_multiple(target, spec=None, create=False, spec_set=None, for choosing which methods to wrap. """ if type(target) in (unicode, str): - - def getter(): - return _importer(target) - # getter = lambda: _importer(target) + getter = lambda: _importer(target) else: - - def getter(): - return target - # getter = lambda: target + getter = lambda: target if not kwargs: raise ValueError( @@ -1460,7 +1445,8 @@ def _patch_multiple(target, spec=None, create=False, spec_set=None, def patch( target, new=DEFAULT, spec=None, create=False, - spec_set=None, autospec=None, new_callable=None, **kwargs): + spec_set=None, autospec=None, new_callable=None, **kwargs + ): """ `patch` acts as a function decorator, class decorator or a context manager. Inside the body of the function or with statement, the `target` @@ -1776,6 +1762,7 @@ def _get_iter(self): return iter(ret_val) return __iter__ + _side_effect_methods = { '__eq__': _get_eq, '__ne__': _get_ne, @@ -1899,6 +1886,7 @@ class _ANY(object): def __repr__(self): return '<ANY>' + ANY = _ANY() @@ -2278,7 +2266,8 @@ def mock_open(mock=None, read_data=''): # set on first use if inPy3k: import _io - file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))) + file_spec = list(set(dir( + _io.TextIOWrapper)).union(set(dir(_io.BytesIO)))) else: file_spec = file diff --git a/test/runtests.py b/test/runtests.py index 15c99ab..83c75f3 100644 --- a/test/runtests.py +++ b/test/runtests.py @@ -1,8 +1,3 @@ -from test_video import * -from test_converter import * -from test_conversion import * -from test_utils import * - try: import lvc except ImportError: @@ -10,6 +5,11 @@ except ImportError: lvc_path = os.path.join(os.path.dirname(__file__), '..') sys.path.append(lvc_path) +from test_video import * +from test_converter import * +from test_conversion import * +from test_utils import * + if __name__ == "__main__": import unittest from lvc.widgets import initialize diff --git a/test/test_conversion.py b/test/test_conversion.py index ff5a8bb..eb933b4 100644 --- a/test/test_conversion.py +++ b/test/test_conversion.py @@ -22,7 +22,7 @@ class FakeConverterInfo(converter.ConverterInfo): def get_arguments(self, video, output): return ['-u', os.path.join( - os.path.dirname(__file__), 'testdata', 'fake_converter.py'), + os.path.dirname(__file__), 'testdata', 'fake_converter.py'), video.filename, output] def process_status_line(self, video, line): @@ -48,7 +48,7 @@ class ConversionManagerTest(base.Test): 'duration': conversion.duration, 'progress': conversion.progress, 'eta': conversion.eta - }) + }) def spin(self, timeout): finish_by = time.time() + timeout @@ -133,7 +133,8 @@ class ConversionManagerTest(base.Test): c = self.manager.start_conversion(vf, self.converter) c2 = self.manager.start_conversion(vf2, self.converter) self.assertEqual(len(self.manager.in_progress), 2) - self.spin(3) # if they're linear, it should take < 5s + # if they're linear, it should take < 5s + self.spin(3) self.assertEqual(c.status, 'finished') self.assertEqual(c2.status, 'finished') diff --git a/test/test_utils.py b/test/test_utils.py index 965fcdb..51fb65e 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -31,12 +31,15 @@ class UtilsTest(base.Test): target = (1024, 768) self.assertEqual(utils.rescale_video(target, target), target) - self.assertEqual(utils.rescale_video((512, 384), target), # small + # small + self.assertEqual(utils.rescale_video((512, 384), target), (512, 384)) - self.assertEqual(utils.rescale_video((2048, 1536), target), # big + # big + self.assertEqual(utils.rescale_video((2048, 1536), target), target) + # widescreen self.assertEqual(utils.rescale_video((1400, 768), target, - dont_upsize=False), # widescreen + dont_upsize=False), (1024, 560)) def test_line_reader(self): diff --git a/test/test_video.py b/test/test_video.py index a0ff18c..0bfc2ae 100644 --- a/test/test_video.py +++ b/test/test_video.py @@ -1,7 +1,7 @@ import os import os.path import tempfile -import threading +# import threading import unittest import mock @@ -14,14 +14,15 @@ class GetMediaInfoTest(base.Test): def assertClose(self, output, expected): diff = output - expected - self.assertTrue(diff ** 2 < 0.04, # abs(diff) < 0.2 + # abs(diff) < 0.2 + self.assertTrue(diff ** 2 < 0.04, "%s != %s" % (output, expected)) def assertEqualOutput(self, filename, expected): full_path = os.path.join(self.testdata_dir, filename) try: output = video.get_media_info(full_path) - except Exception, e: + except Exception as e: raise AssertionError( 'Error parsing %r\nException: %r\nOutput: %s' % ( filename, e, video.get_ffmpeg_output(full_path))) diff --git a/test/testdata/fake_converter.py b/test/testdata/fake_converter.py index bd049bc..ab27064 100644 --- a/test/testdata/fake_converter.py +++ b/test/testdata/fake_converter.py @@ -18,12 +18,12 @@ time.sleep(0.5) RANGE = 5 for i in range(RANGE): print(json.dumps({ - 'filename': filename, - 'output': output, - 'duration': RANGE, - 'progress': i, - 'eta': RANGE - i - })) + 'filename': filename, + 'output': output, + 'duration': RANGE, + 'progress': i, + 'eta': RANGE - i + })) time.sleep(0.1) with file(output, 'w') as f: diff --git a/test/uitests.sikuli/config.py b/test/uitests.sikuli/config.py index 27e7a74..ab89dc8 100644 --- a/test/uitests.sikuli/config.py +++ b/test/uitests.sikuli/config.py @@ -1,4 +1,4 @@ -# config.py +#config.py import os import time from sikuli.Sikuli import * @@ -8,8 +8,9 @@ def set_image_dirs(): """Set the Sikuli image path for the os specific image directory and the main Image dir. """ - os_imgs = os.path.join(os.path.dirname(os.path.abspath(__file__)), - "Images_"+get_os_name()) + os_imgs = os.path.join( + os.path.dirname( + os.path.abspath(__file__)), "Images_"+get_os_name()) imgs = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Images") dir_list = [imgs, os_imgs] @@ -41,10 +42,11 @@ def launch_cmd(): if get_os_name() == "osx": launch_cmd = "/Applications/Libre Video Converter.app" elif get_os_name() == "win": - launch_cmd = os.path.join(os.getenv("PROGRAMFILES"), - "Participatory Culture Foundation", - "Libre Video Converter", - "LibreConverter.exe") + launch_cmd = os.path.join( + os.getenv("PROGRAMFILES"), + "Participatory Culture Foundation", + "Libre Video Converter", + "LibreVideoConverter.exe") else: print(get_os_name()) print(launch_cmd) diff --git a/test/uitests.sikuli/datafiles.py b/test/uitests.sikuli/datafiles.py index 5d11ed0..d1191ca 100644 --- a/test/uitests.sikuli/datafiles.py +++ b/test/uitests.sikuli/datafiles.py @@ -1,21 +1,20 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- # Default Device Conversion Parameters - import os class TestData(object): - - _UNITTESTFILES = \ - os.path.abspath(os.path.join(os.path.dirname( - os.path.abspath(__file__)), '..', '..', '..', 'testdata')) - _SIKTESTFILES = \ - os.path.abspath(os.path.join(os.path.dirname( - os.path.abspath(__file__)), 'testdata')) + _UNITTESTFILES = os.path.abspath( + os.path.join( + os.path.dirname( + os.path.abspath( + __file__)), "..", "..", "..", 'testdata')) + _SIKTESTFILES = os.path.abspath( + os.path.join( + os.path.dirname( + os.path.abspath(__file__)), 'testdata')) _FILES = { - 'mp3-0.mp3': { + 'mp3-0.mp3': { 'testdir': _UNITTESTFILES, 'container': 'mp3', 'audio_codec': 'mp3', @@ -24,9 +23,10 @@ class TestData(object): 'album': 'Increase The Dosage', 'track': '1', 'genre': 'Blues', - 'duration': 1.07, - }, - 'mp3-1.mp3': { + 'duration': 1.07 + }, + 'mp3-1.mp3': + { 'testdir': _UNITTESTFILES, 'container': 'mp3', 'audio_codec': 'mp3', @@ -34,67 +34,72 @@ class TestData(object): 'artist': 'Ckz', 'album': 'The Heart EP', 'track': '2/5', - 'duration': 1.07, - }, - 'mp3-2.mp3': { + 'duration': 1.07 + }, + 'mp3-2.mp3': + { 'testdir': _UNITTESTFILES, 'container': 'mp3', 'audio_codec': 'mp3', 'artist': 'This American Life', 'genre': 'Podcast', 'title': '#426: Tough Room 2011', - 'duration': 1.09, - }, - 'theora_with_ogg_extension.ogg': { + 'duration': 1.09 + }, + 'theora_with_ogg_extension.ogg': + { 'testdir': _UNITTESTFILES, 'container': 'ogg', 'video_codec': 'theora', 'width': 320, 'height': 240, - 'duration': 0.1, - }, - 'webm-0.webm': { + 'duration': 0.1 + }, + 'webm-0.webm': + { 'testdir': _UNITTESTFILES, 'container': ['matroska', 'webm'], 'video_codec': 'vp8', 'width': 1920, 'height': 912, - 'duration': 0.43, - }, - 'mp4-0.mp4': { + 'duration': 0.43 + }, + 'mp4-0.mp4': + { 'testdir': _UNITTESTFILES, - 'container': [ - 'mov', - 'mp4', - 'm4a', - '3gp', - '3g2', - 'mj2', - 'isom', - 'mp41', - ], + 'container': ['mov', + 'mp4', + 'm4a', + '3gp', + '3g2', + 'mj2', + 'isom', + 'mp41'], 'video_codec': 'h264', 'audio_codec': 'aac', 'width': 640, 'height': 480, 'title': 'Africa: Cash for Climate Change?', - 'duration': 312.37, - }, - 'nuls.mp3': {'testdir': _UNITTESTFILES, 'container': 'mp3', - 'title': 'Invisible'}, - 'drm.m4v': { + 'duration': 312.37 + }, + 'nuls.mp3': + { 'testdir': _UNITTESTFILES, - 'container': [ - 'mov', - 'mp4', - 'm4a', - '3gp', - '3g2', - 'mj2', - 'M4V', - 'mp42', - 'isom', - ], + 'container': 'mp3', + 'title': 'Invisible' + }, + 'drm.m4v': + { + 'testdir': _UNITTESTFILES, + 'container': ['mov', + 'mp4', + 'm4a', + '3gp', + '3g2', + 'mj2', + 'M4V', + 'mp42', + 'isom'], 'video_codec': 'none', 'audio_codec': 'aac', 'has_drm': ['audio', 'video'], @@ -105,33 +110,38 @@ class TestData(object): 'album': 'The Most Extreme', 'track': '10', 'genre': 'Nonfiction', - 'duration': 2668.8, - }, - 'baby_block.m4v': { + 'duration': 2668.8 + }, + 'baby_block.m4v': + { 'testdir': _SIKTESTFILES, 'container': 'm4v', 'video_codec': 'h264', 'audio_codec': 'aac', 'width': 960, 'height': 540, - }, - 'fake_video.mp4': { + }, + # this is a fake mp4 file it is a pdf file renamed to an mp4 + # extension and should fail conversion + 'fake_video.mp4': + { 'testdir': _SIKTESTFILES, 'container': 'mp4', 'video_codec': None, 'audio_codec': None, 'width': None, 'height': None, - }, - 'story_stuff.mov': { + }, + 'story_stuff.mov': + { 'testdir': _SIKTESTFILES, 'container': 'mov', 'video_codec': 'h264', 'audio_codec': 'mp3', 'width': 320, 'height': 180, - }, } + } def testfile_attr(self, testfile, default): try: @@ -141,7 +151,7 @@ class TestData(object): def directory_list(self, testdir): files_list = [] - for (k, v) in self._FILES.iteritems(): + for k, v in self._FILES.iteritems(): if v.has_key('testdir') and testdir in v['testdir']: files_list.append(k) return files_list @@ -153,7 +163,6 @@ class TestData(object): but, if I need extra files, getting them from the sikuli test files dir. """ - DEFAULT_UNITTESTFILES = ['mp4-0.mp4', 'webm-0.webm'] DEFAULT_SIKTESTFILES = ['baby_block.m4v', 'story_styff.mov'] if new: @@ -167,4 +176,4 @@ class TestData(object): TESTFILES = TESTFILES[:1] print(TESTFILES) - return (DATADIR, TESTFILES) + return DATADIR, TESTFILES diff --git a/test/uitests.sikuli/lvc_steps.py b/test/uitests.sikuli/lvc_steps.py index 5723b6a..2d8be58 100644 --- a/test/uitests.sikuli/lvc_steps.py +++ b/test/uitests.sikuli/lvc_steps.py @@ -36,7 +36,8 @@ def device_output(option): @step('I browse for (?:a|several)( new)? file(s)?') -def browse_for_files(step, new, several): # file or files determines 1 or many +# file or files determines 1 or many +def browse_for_files(step, new, several): datadir, testfiles = test_data(several, new) print(testfiles) world.lvc.browse_for_files(datadir, testfiles) @@ -102,7 +103,8 @@ def then_the_list_of_files_is_empty(step): @step('I have converted (?:a|some) file(s)?') def have_converted_file(step, amount): if amount is None: - browse_file = ('I browse for a file') # file or files determines + # file or files determines 1 or many + browse_file = ('I browse for a file') else: browse_file = ('I browse for some files') step.given(browse_file) diff --git a/test/uitests.sikuli/lvcgui.py b/test/uitests.sikuli/lvcgui.py index 4d9d65a..daa572c 100644 --- a/test/uitests.sikuli/lvcgui.py +++ b/test/uitests.sikuli/lvcgui.py @@ -1,9 +1,11 @@ from sikuli.Sikuli import * import devices import config +import time class MVCGui(object): + # ** APP UI IMAGES ** # ADD FILES @@ -69,7 +71,6 @@ class MVCGui(object): ''' config.set_image_dirs() self.os_name = config.get_os_name() - # CMD or CTRL Key if self.os_name == 'osx': self.CMDCTRL = Key.CMD @@ -101,7 +102,8 @@ class MVCGui(object): def browse_for_files(self, dirname, testdata): click(Pattern(self._CHOOSE_FILES)) - time.sleep(2) # osx freaks out if you start typing too fast + # osx freaks out if you start typing too fast + time.sleep(2) self.type_a_path(dirname) keyDown(self.CMDCTRL) for f in testdata: @@ -115,17 +117,20 @@ class MVCGui(object): def drag_and_drop_files(self, dirname, testdata): click(self._CHOOSE_FILES) - y = getLastMatch() # y is drop destination + # y is drop destination + y = getLastMatch() type(dirname) type(Key.ENTER) keyDown(self.CMDCTRL) for f in testdata: find(f) - x = getLastMatch() # the drag start's last file we find and select + # the drag start is the last file we find and select + x = getLastMatch() click(getLastMatch()) dragDrop(x, y) keyUp(self.CMDCTRL) - type(Key.ESC) # close the file browser dialog + # close the file browser dialog + type(Key.ESC) def remove_files(self, *items): for item in items: @@ -166,8 +171,7 @@ class MVCGui(object): def choose_device_conversion(self, device): device_group = devices.dev_attr(device, 'group') - menu_img = getattr(self, "".join(["_", device_group.upper(), - "_", "MENU"])) + menu_img = getattr(self, "".join(["_",device_group.upper(),"_","MENU"])) click(menu_img) click(device) @@ -193,11 +197,11 @@ class MVCGui(object): if setting not in valid_settings: print("valid setting value not proviced, must be 'on' or 'off'") # CHECK THE BOX - pref_image = getattr(self, "".join(["_", option])) + pref_image = getattr(self, "".join(["_",option])) find(pref_image) reg = Region(getLastMatch()) - box = Region(reg.getX()-15, sr_loc.getY()-10, pref_reg.getW(), 30) # location of associated checkbox + box = Region(reg.getX()-15, sr_loc.getY()-10, pref_reg.getW(), 30) if setting == "off": if box.exists(self._PREFS_CHECKBOX_CHECKED): click(box.getLastMatch()) @@ -251,8 +255,8 @@ class MVCGui(object): if exists(device): return True else: + # all devices are mp4 by default if exists(device) and exists("MP4"): - # all devices are mp4 by default return True def verify_size(self, item, width, height): @@ -260,8 +264,8 @@ class MVCGui(object): expected_size_parameter = "-s "+width+"x"+height type(self.CMDCTRL, 'f') type('-s '+width+'x'+'height') - type(self.CMDCTRL, 'c') # copy the ffmpeg size command to the clipboard + type(self.CMDCTRL, 'c') size_param = Env.getClipboard() if size_param == expected_size_parameter: return True @@ -336,11 +340,9 @@ class MVCGui(object): def verify_in_progress(self, item=None): if item: r = self.item_region(item) - if r.exists(self._IN_PROGRESS): - return True + if r.exists(self._IN_PROGRESS): return True else: - if exists(self._IN_PROGRESS): - return True + if exists(self._IN_PROGRESS): return True def verify_itunes(self, item): pass diff --git a/test/uitests.sikuli/readme.md b/test/uitests.sikuli/readme.md index 99e0424..cf5edc0 100644 --- a/test/uitests.sikuli/readme.md +++ b/test/uitests.sikuli/readme.md @@ -1,8 +1,6 @@ Libre Video Converter ====================== -<img src="http://cl.ly/ECBE/o"/></img> - LVC has a complete UI overhaul designed to maintain the simplicity of previous versions but also provide users with batch processing options and give users greater control over their converted files. diff --git a/test/uitests.sikuli/test_android_conversions.py b/test/uitests.sikuli/test_android_conversions.py index b904374..3ecde7f 100644 --- a/test/uitests.sikuli/test_android_conversions.py +++ b/test/uitests.sikuli/test_android_conversions.py @@ -2,7 +2,6 @@ import devices from sikuli.Sikuli import * -import devices import config from lvcgui import MVCGui import datafiles @@ -19,7 +18,6 @@ def test_android_conversions(): def test_android_size_output_default(): """Scenario: the output format and size are defaults when device selected. - """ device_list = devices.devices('Android') datadir, testfiles = data.test_data(many=True, new=True) @@ -34,8 +32,8 @@ def test_android_size_output_default(): def device_defaults(device_output, lvc): print(device_output) lvc.choose_device_conversion(device_output) - width = device.device_attr(device_output, 'width') - height = device.device_attr(device_output, 'height') + width = devices.device_attr(device_output, 'width') + height = devices.device_attr(device_output, 'height') default_format = 'MP4' assert lvc.verify_device_format_selected(device_output) assert lvc.verify_device_size_default(str(width), str(height)) diff --git a/test/uitests.sikuli/test_apple_conversions.py b/test/uitests.sikuli/test_apple_conversions.py index 7b9bc3a..605cf2d 100644 --- a/test/uitests.sikuli/test_apple_conversions.py +++ b/test/uitests.sikuli/test_apple_conversions.py @@ -2,7 +2,6 @@ import devices from sikuli.Sikuli import * -import devices import config from lvcgui import MVCGui import datafiles @@ -12,6 +11,7 @@ data = datafiles.TestData() def test_apple_conversions(): """Scenario: test each android conversion option. + """ device_list = devices.devices('Apple') for x in device_list: @@ -35,8 +35,8 @@ def test_apple_size_output_default(): def device_defaults(device_output, lvc): print(device_output) lvc.choose_device_conversion(device_output) - width = device.device_attr(device_output, 'width') - height = device.device_attr(device_output, 'height') + width = devices.device_attr(device_output, 'width') + height = devices.device_attr(device_output, 'height') default_format = 'MP4' assert lvc.verify_device_format_selected(device_output) assert lvc.verify_device_size_default(str(width), str(height)) diff --git a/test/uitests.sikuli/test_choose_files.py b/test/uitests.sikuli/test_choose_files.py index 1a93da0..7ef3d92 100644 --- a/test/uitests.sikuli/test_choose_files.py +++ b/test/uitests.sikuli/test_choose_files.py @@ -14,7 +14,6 @@ class Test_Choose_Files(unittest.TestCase): """Add files to the conversion list either via browse or drag-n-drop. """ - def setUp(self): """ setup app for tests diff --git a/test/uitests.sikuli/test_clear_finished_conversions.py b/test/uitests.sikuli/test_clear_finished_conversions.py index 3962deb..90b9ef1 100644 --- a/test/uitests.sikuli/test_clear_finished_conversions.py +++ b/test/uitests.sikuli/test_clear_finished_conversions.py @@ -22,7 +22,6 @@ class Test_Clear_Finished_Conversions(unittest.TestCase): def setUp(self): """ Each tests assumes that I there are files that have been converted. - """ self.lvc = MVCGui() self.lvc.lvc_focus() diff --git a/test/uitests.sikuli/test_conversions.py b/test/uitests.sikuli/test_conversions.py index 449c6d5..d305460 100644 --- a/test/uitests.sikuli/test_conversions.py +++ b/test/uitests.sikuli/test_conversions.py @@ -5,6 +5,7 @@ import os import tempfile import shutil import unittest +import lvc from lvcgui import MVCGui import datafiles import devices @@ -20,8 +21,8 @@ class Test_Conversions(unittest.TestCase): def setUp(self): """ - Each tests assumes that I there are files in the - list ready to be converted to some format. + Each tests assumes that I there are files in the list ready + to be converted to some format. """ self.lvc = MVCGui() @@ -54,7 +55,6 @@ class Test_Conversions(unittest.TestCase): When I convert a file Then the output file is in the specified directory """ - custom_output_dir = os.path.join(os.getenv("HOME"), "Desktop") item = "mp4-0.mp4" lvc.lvcGui() @@ -86,7 +86,7 @@ class Test_Conversions(unittest.TestCase): When I convert a file Then it is named with the file name (or even better item title) - as the base and the output container is the extension + As the base and the output container is the extension """ self.fail('I do not know the planned naming convention yet') @@ -95,38 +95,39 @@ class Test_Conversions(unittest.TestCase): When I convert a file Then it is named with the file name (or even better item title) - as the base and the output container is the extension + As the base and the output container is the extension """ self.fail('I do not know the planned naminig convention yet') def test_output_video_no_upsize(self): datadir, testfile = data.test_data() - item = testfile[0] # mp4-0.mp4 is smaller than the Apple Universal Setting + item = testfile[0] lvc.lvcGui() lvc.choose_device_conversion("Apple Universal") lvc.choose_dont_upsize('on') lvc.start_conversion() - assert lvc.verify_size(os.path.join(datadir, item), width, height) + assert lvc.verify_size(os.path.join( + datadir, item), width, height) """Scenario: Output file video size. When I convert a file to "format" And Don't Upsize is selected - Then the output file dimensions are not changed if the - input file is smaller than the device + Then the output file dimensions are not changed if the input file + is smaller than the device """ - # This test is best covered more completely in unittests to verify - # that we resize according to device sizes - item = "mp4-0.mp4" + # This test is best covered more completely in unittests + # to verify that we resize according to device sizes # mp4-0.mp4 is smaller than the Apple Universal Setting + item = "mp4-0.mp4" lvc.lvcGui() lvc.choose_device_conversion("Apple Universal") lvc.choose_dont_upsize('on') lvc.start_conversion() - assert lvc.verify_size(os.path.join(self.output_dir, item), - width, height) + assert lvc.verify_size(os.path.join( + self.output_dir, item), width, height) def test_output_video_upsize(self): """Scenario: Output file video size. @@ -135,17 +136,18 @@ class Test_Conversions(unittest.TestCase): And Don't Upsize is NOT selected The the output file dimensions are changed to match the device spec. """ - # This test is best covered more completely in unittests to verify - # that we resize according to device sizes - item = "mp4-0.mp4" + # This test is best covered more completely in unittests + # to verify that we resize according to device sizes + # mp4-0.mp4 is smaller than the Apple Universal Setting + item = "mp4-0.mp4" lvc.lvcGui() lvc.choose_device_conversion("Apple Universal") lvc.choose_dont_upsize('off') lvc.start_conversion() - assert lvc.verify_size(os.path.join(self.output_dir, item), - width, height) + assert lvc.verify_size(os.path.join( + self.output_dir, item), width, height) def test_completed_conversions_display(self): """Scenario: File displays as completed. diff --git a/test/uitests.sikuli/test_output_settings.py b/test/uitests.sikuli/test_output_settings.py index b44e5a0..97c711a 100644 --- a/test/uitests.sikuli/test_output_settings.py +++ b/test/uitests.sikuli/test_output_settings.py @@ -18,8 +18,8 @@ class Test_Custom_Settings(unittest.TestCase): """ def setUp(self): """ - Each tests assumes that I there are files in the - list ready to be converted to some format. + Each tests assumes that I there are files in the list ready to be + converted to some format. """ self.lvc = MVCGui() diff --git a/test/uitests.sikuli/test_remove_files.py b/test/uitests.sikuli/test_remove_files.py index e3e4a06..eefd383 100644 --- a/test/uitests.sikuli/test_remove_files.py +++ b/test/uitests.sikuli/test_remove_files.py @@ -3,6 +3,7 @@ import os import tempfile import shutil import unittest +import lvc from lvcgui import MVCGui import datafiles import devices @@ -14,7 +15,6 @@ class Test_Remove_Files(unittest.TestCase): """Remove files from the conversion list """ - def setUp(self): """ setup app for tests @@ -33,7 +33,6 @@ class Test_Remove_Files(unittest.TestCase): When I remove it from the list Then it is not in the list """ - lvc.lvcGui() _, testfiles = data.test_data(many=False) item = testfiles[0] @@ -73,8 +72,8 @@ class Test_Remove_Files(unittest.TestCase): assert lvc.verify_completed(item, 160) def test_remove_last_queued_file_with_in_progress_conversions(self): - """Scenario: Remove the last queued file from the - list with conversions in progress. + """Scenario: Remove the last queued file from the list with + conversions in progress. Given I have lots of files files in the list And I start conversion diff --git a/test/uitests.sikuli/uitests.py b/test/uitests.sikuli/uitests.py index 8b0a248..b723eb9 100644 --- a/test/uitests.sikuli/uitests.py +++ b/test/uitests.sikuli/uitests.py @@ -1,9 +1,9 @@ import os import sys +sys.path.append(os.getenv('PYTHON_PKGS')) import nose import nose.config -sys.path.append(os.getenv('PYTHON_PKGS')) myconfig = os.path.join(os.getcwd(), 'tests.sikuli', 'nose.cfg') nose.config.config_files = [myconfig] |