Merge pull request #148 from jmathai/add-audio-file-tests-gh-61
Enable tests for audio and video files which were disabled for TravisCI
This commit is contained in:
commit
7edcfed421
|
@ -38,7 +38,6 @@ def test_import_file_text():
|
||||||
assert helper.path_tz_fix(os.path.join('2016-04-Apr','Unknown Location','2016-04-07_11-15-26-valid-sample-title.txt')) in dest_path, dest_path
|
assert helper.path_tz_fix(os.path.join('2016-04-Apr','Unknown Location','2016-04-07_11-15-26-valid-sample-title.txt')) in dest_path, dest_path
|
||||||
|
|
||||||
def test_import_file_audio():
|
def test_import_file_audio():
|
||||||
raise SkipTest('gh-61 this test fails on travisci')
|
|
||||||
temporary_folder, folder = helper.create_working_folder()
|
temporary_folder, folder = helper.create_working_folder()
|
||||||
temporary_folder_destination, folder_destination = helper.create_working_folder()
|
temporary_folder_destination, folder_destination = helper.create_working_folder()
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ def test_import_file_audio():
|
||||||
shutil.rmtree(folder)
|
shutil.rmtree(folder)
|
||||||
shutil.rmtree(folder_destination)
|
shutil.rmtree(folder_destination)
|
||||||
|
|
||||||
assert helper.path_tz_fix(os.path.join('2016-01-Jan','Houston','2016-01-04_05-28-15-audio-test-audio.m4a')) in dest_path, dest_path
|
assert helper.path_tz_fix(os.path.join('2016-01-Jan','Houston','2016-01-04_05-28-15-audio.m4a')) in dest_path, dest_path
|
||||||
|
|
||||||
def test_import_file_photo():
|
def test_import_file_photo():
|
||||||
temporary_folder, folder = helper.create_working_folder()
|
temporary_folder, folder = helper.create_working_folder()
|
||||||
|
|
|
@ -9,8 +9,6 @@ import tempfile
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from nose.plugins.skip import SkipTest
|
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))))
|
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))))
|
||||||
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
|
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
|
||||||
|
|
||||||
|
@ -32,32 +30,28 @@ def test_audio_extensions():
|
||||||
assert extensions == valid_extensions, valid_extensions
|
assert extensions == valid_extensions, valid_extensions
|
||||||
|
|
||||||
def test_get_coordinate():
|
def test_get_coordinate():
|
||||||
raise SkipTest('gh-61 this test fails on travisci')
|
|
||||||
audio = Audio(helper.get_file('audio.m4a'))
|
audio = Audio(helper.get_file('audio.m4a'))
|
||||||
coordinate = audio.get_coordinate()
|
coordinate = audio.get_coordinate()
|
||||||
|
|
||||||
assert coordinate == 29.75893888888889, coordinate
|
assert helper.isclose(coordinate, 29.758938), coordinate
|
||||||
|
|
||||||
def test_get_coordinate_latitude():
|
def test_get_coordinate_latitude():
|
||||||
raise SkipTest('gh-61 this test fails on travisci')
|
|
||||||
audio = Audio(helper.get_file('audio.m4a'))
|
audio = Audio(helper.get_file('audio.m4a'))
|
||||||
coordinate = audio.get_coordinate('latitude')
|
coordinate = audio.get_coordinate('latitude')
|
||||||
|
|
||||||
assert coordinate == 29.75893888888889, coordinate
|
assert helper.isclose(coordinate, 29.758938), coordinate
|
||||||
|
|
||||||
def test_get_coordinate_longitude():
|
def test_get_coordinate_longitude():
|
||||||
raise SkipTest('gh-61 this test fails on travisci')
|
|
||||||
audio = Audio(helper.get_file('audio.m4a'))
|
audio = Audio(helper.get_file('audio.m4a'))
|
||||||
coordinate = audio.get_coordinate('longitude')
|
coordinate = audio.get_coordinate('longitude')
|
||||||
|
|
||||||
assert coordinate == -95.3677, coordinate
|
assert helper.isclose(coordinate, -95.3677), coordinate
|
||||||
|
|
||||||
def test_get_date_taken():
|
def test_get_date_taken():
|
||||||
raise SkipTest('gh-32 this test fails on travisci')
|
|
||||||
audio = Audio(helper.get_file('audio.m4a'))
|
audio = Audio(helper.get_file('audio.m4a'))
|
||||||
date_taken = audio.get_date_taken()
|
date_taken = audio.get_date_taken()
|
||||||
|
|
||||||
assert date_taken == (2016, 1, 4, 5, 24, 15, 0, 19, 0), date_taken
|
assert date_taken == (2016, 1, 4, 5, 28, 15, 0, 4, 0), date_taken
|
||||||
|
|
||||||
def test_get_exiftool_attributes():
|
def test_get_exiftool_attributes():
|
||||||
audio = Video(helper.get_file('audio.m4a'))
|
audio = Video(helper.get_file('audio.m4a'))
|
||||||
|
@ -169,7 +163,6 @@ def test_set_title():
|
||||||
assert metadata['title'] == 'my audio title', metadata['title']
|
assert metadata['title'] == 'my audio title', metadata['title']
|
||||||
|
|
||||||
def test_set_title_non_ascii():
|
def test_set_title_non_ascii():
|
||||||
raise SkipTest('gh-27, non-ascii characters')
|
|
||||||
temporary_folder, folder = helper.create_working_folder()
|
temporary_folder, folder = helper.create_working_folder()
|
||||||
|
|
||||||
origin = '%s/audio.m4a' % folder
|
origin = '%s/audio.m4a' % folder
|
||||||
|
@ -178,7 +171,8 @@ def test_set_title_non_ascii():
|
||||||
audio = Audio(origin)
|
audio = Audio(origin)
|
||||||
origin_metadata = audio.get_metadata()
|
origin_metadata = audio.get_metadata()
|
||||||
|
|
||||||
status = audio.set_title('形声字 / 形聲字')
|
unicode_title = u'形声字 / 形聲字'
|
||||||
|
status = audio.set_title(unicode_title)
|
||||||
|
|
||||||
assert status == True, status
|
assert status == True, status
|
||||||
|
|
||||||
|
@ -187,4 +181,4 @@ def test_set_title_non_ascii():
|
||||||
|
|
||||||
shutil.rmtree(folder)
|
shutil.rmtree(folder)
|
||||||
|
|
||||||
assert metadata['title'] == '形声字 / 形聲字', metadata['title']
|
assert metadata['title'] == unicode_title, metadata['title']
|
||||||
|
|
|
@ -317,7 +317,7 @@ def _test_photo_type_get(type, date):
|
||||||
if not photo_file:
|
if not photo_file:
|
||||||
photo_file = helper.download_file(photo_name, folder)
|
photo_file = helper.download_file(photo_name, folder)
|
||||||
if not photo_file or not os.path.isfile(photo_file):
|
if not photo_file or not os.path.isfile(photo_file):
|
||||||
raise SkipTest('nef file not downlaoded')
|
raise SkipTest('{} file not downlaoded'.format(type))
|
||||||
|
|
||||||
# downloading for each test is costly so we save it in the working directory
|
# downloading for each test is costly so we save it in the working directory
|
||||||
file_path_save_as = helper.get_file_path(photo_name)
|
file_path_save_as = helper.get_file_path(photo_name)
|
||||||
|
|
|
@ -8,8 +8,6 @@ import tempfile
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from nose.plugins.skip import SkipTest
|
|
||||||
|
|
||||||
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))))
|
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))))
|
||||||
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
|
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
|
||||||
|
|
||||||
|
@ -167,7 +165,6 @@ def test_set_title():
|
||||||
assert metadata['title'] == 'my video title', metadata['title']
|
assert metadata['title'] == 'my video title', metadata['title']
|
||||||
|
|
||||||
def test_set_title_non_ascii():
|
def test_set_title_non_ascii():
|
||||||
raise SkipTest('gh-27, non-ascii characters')
|
|
||||||
temporary_folder, folder = helper.create_working_folder()
|
temporary_folder, folder = helper.create_working_folder()
|
||||||
|
|
||||||
origin = '%s/video.mov' % folder
|
origin = '%s/video.mov' % folder
|
||||||
|
@ -176,7 +173,8 @@ def test_set_title_non_ascii():
|
||||||
video = Video(origin)
|
video = Video(origin)
|
||||||
origin_metadata = video.get_metadata()
|
origin_metadata = video.get_metadata()
|
||||||
|
|
||||||
status = video.set_title('形声字 / 形聲字')
|
unicode_title = u'形声字 / 形聲字'
|
||||||
|
status = video.set_title(unicode_title)
|
||||||
|
|
||||||
assert status == True, status
|
assert status == True, status
|
||||||
|
|
||||||
|
@ -185,4 +183,4 @@ def test_set_title_non_ascii():
|
||||||
|
|
||||||
shutil.rmtree(folder)
|
shutil.rmtree(folder)
|
||||||
|
|
||||||
assert metadata['title'] == '形声字 / 形聲字', metadata['title']
|
assert metadata['title'] == unicode_title, metadata['title']
|
||||||
|
|
Loading…
Reference in New Issue