This commit is contained in:
Simon Conseil
2015-08-07 00:35:07 +02:00
parent be105078cd
commit 24763d46fc
5 changed files with 11 additions and 9 deletions

View File

@@ -95,8 +95,8 @@ def build(source, destination, debug, verbose, force, config, theme, title,
corresponding values from the settings file.
"""
level = ((debug and logging.DEBUG) or (verbose and logging.INFO)
or logging.WARNING)
level = ((debug and logging.DEBUG) or (verbose and logging.INFO) or
logging.WARNING)
init_logging(__name__, level=level)
logger = logging.getLogger(__name__)
@@ -117,13 +117,13 @@ def build(source, destination, debug, verbose, force, config, theme, title,
logger.error("Input directory not found: %s", settings['source'])
sys.exit(1)
# on windows os.path.relpath raises a ValueError if the two paths are on
# different drives, in that case we just ignore the exception as the two
# on windows os.path.relpath raises a ValueError if the two paths are on
# different drives, in that case we just ignore the exception as the two
# paths are anyway not relative
relative_check = True
try:
relative_check = os.path.relpath(settings['destination'],
settings['source']).startswith('..')
relative_check = os.path.relpath(settings['destination'],
settings['source']).startswith('..')
except ValueError:
pass

View File

@@ -38,7 +38,6 @@ from collections import defaultdict
from datetime import datetime
from itertools import cycle
from os.path import isfile, join, splitext
from PIL import Image as PILImage
from . import image, video, signals
from .compat import PY2, UnicodeMixin, strxfrm, url_quote, text_type

View File

@@ -160,7 +160,8 @@ def process_video(filepath, outpath, settings):
video_format = settings['video_format']
if video_format not in valid_formats:
raise ValueError('Invalid video_format. Please choose one of: ' + str(valid_formats))
raise ValueError('Invalid video_format. Please choose one of: '
+ str(valid_formats))
outname = os.path.join(outpath, basename + '.' + video_format)
generate_video(filepath, outname, settings,

View File

@@ -20,6 +20,7 @@ def test_init(tmpdir):
assert result.output == ("Found an existing config file, will abort to "
"keep it safe.\n")
def test_serve(tmpdir):
config_file = str(tmpdir.join('sigal.conf.py'))
runner = CliRunner()
@@ -31,4 +32,3 @@ def test_serve(tmpdir):
result = runner.invoke(serve, ['-c', config_file])
assert result.exit_code == 1

View File

@@ -16,6 +16,8 @@ SRCFILE = os.path.join(CURRENT_DIR, 'sample', 'pictures', 'video', TEST_VIDEO)
def test_video_size():
size_src = video_size(SRCFILE)
assert size_src == (480, 270)
size_src = video_size('missing/file.mp4')
assert size_src == (0, 0)
@pytest.mark.parametrize("fmt", ['webm', 'mp4'])