2018-01-04 00:15:47 +01:00
|
|
|
# -*- coding:utf-8 -*-
|
|
|
|
|
|
2018-02-10 00:07:28 +01:00
|
|
|
import blinker
|
2018-01-04 00:15:47 +01:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
from sigal.gallery import Gallery
|
2018-02-10 00:07:28 +01:00
|
|
|
from sigal import init_plugins, signals
|
2018-01-04 00:15:47 +01:00
|
|
|
|
|
|
|
|
CURRENT_DIR = os.path.dirname(__file__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_plugins(settings, tmpdir):
|
|
|
|
|
|
|
|
|
|
settings['destination'] = str(tmpdir)
|
|
|
|
|
if "sigal.plugins.nomedia" not in settings["plugins"]:
|
|
|
|
|
settings['plugins'] += ["sigal.plugins.nomedia"]
|
|
|
|
|
if "sigal.plugins.media_page" not in settings["plugins"]:
|
|
|
|
|
settings['plugins'] += ["sigal.plugins.media_page"]
|
|
|
|
|
|
2018-02-10 00:07:28 +01:00
|
|
|
try:
|
|
|
|
|
init_plugins(settings)
|
|
|
|
|
gal = Gallery(settings)
|
|
|
|
|
gal.build()
|
|
|
|
|
finally:
|
|
|
|
|
# Reset plugins
|
|
|
|
|
for name in dir(signals):
|
|
|
|
|
if not name.startswith('_'):
|
|
|
|
|
try:
|
|
|
|
|
sig = getattr(signals, name)
|
|
|
|
|
if isinstance(sig, blinker.Signal):
|
|
|
|
|
sig.receivers.clear()
|
|
|
|
|
except Exception:
|
|
|
|
|
pass
|
2018-01-04 00:15:47 +01:00
|
|
|
|
|
|
|
|
out_html = os.path.join(settings['destination'],
|
|
|
|
|
'dir2', 'exo20101028-b-full.jpg.html')
|
|
|
|
|
assert os.path.isfile(out_html)
|
|
|
|
|
|
|
|
|
|
for path, dirs, files in os.walk(os.path.join(str(tmpdir), "nomedia")):
|
|
|
|
|
assert "ignore" not in path
|
|
|
|
|
|
|
|
|
|
for file in files:
|
|
|
|
|
assert "ignore" not in file
|