Browse Source

Try running test_album without setting the locale (#339)

pull/340/head
Simon Conseil 8 years ago committed by GitHub
parent
commit
75c4ab13aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      tests/test_gallery.py

41
tests/test_gallery.py

@ -1,4 +1,3 @@
import locale
import logging
import os
import pytest
@ -152,31 +151,21 @@ def test_video(settings, tmpdir):
@pytest.mark.parametrize("path,album", REF.items())
def test_album(path, album, settings, tmpdir):
# store current locale
old_locale = locale.setlocale(locale.LC_ALL)
# locale.setlocale(locale.LC_ALL, 'fr_FR')
locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
try:
gal = Gallery(settings, ncpu=1)
a = Album(path, settings, album['subdirs'], album['medias'], gal)
assert a.title == album['title']
assert a.name == album['name']
assert a.subdirs == album['subdirs']
assert a.thumbnail == album['thumbnail']
if path == 'video':
assert list(a.images) == []
assert [m.filename for m in a.medias] == \
[album['medias'][0].replace('.ogv', '.webm')]
else:
assert list(a.videos) == []
assert [m.filename for m in a.medias] == album['medias']
assert len(a) == len(album['medias'])
finally:
# restore locale back
locale.setlocale(locale.LC_ALL, old_locale)
gal = Gallery(settings, ncpu=1)
a = Album(path, settings, album['subdirs'], album['medias'], gal)
assert a.title == album['title']
assert a.name == album['name']
assert a.subdirs == album['subdirs']
assert a.thumbnail == album['thumbnail']
if path == 'video':
assert list(a.images) == []
assert [m.filename for m in a.medias] == \
[album['medias'][0].replace('.ogv', '.webm')]
else:
assert list(a.videos) == []
assert [m.filename for m in a.medias] == album['medias']
assert len(a) == len(album['medias'])
def test_albums_sort(settings):

Loading…
Cancel
Save