def paths(): """Read the sample config file and build the PathsDb object.""" default_conf = os.path.join(SAMPLE_DIR, 'sigal.conf.py') settings = read_settings(default_conf) return PathsDb(os.path.join(SAMPLE_DIR, 'pictures'), settings['img_ext_list'], settings['vid_ext_list'])
def make_gallery(source_dir='dir1', **kwargs): default_conf = os.path.join(SAMPLE_DIR, 'sigal.conf.py') settings = read_settings(default_conf) settings['source'] = os.path.join(SAMPLE_SOURCE, source_dir) settings.update(kwargs) init_plugins(settings) return Gallery(settings, ncpu=1)
def test_img_sizes(tmpdir): """Test that image size is swaped if needed.""" conf = tmpdir.join('sigal.conf.py') conf.write("thumb_size = (150, 200)") settings = read_settings(str(conf)) assert settings['thumb_size'] == (200, 150)
def setUp(cls): """Read the sample config file.""" default_conf = os.path.join(CURRENT_DIR, 'sample', 'sigal.conf.py') settings = read_settings(default_conf) cls.gal = Gallery(settings, os.path.join(CURRENT_DIR, 'sample'), os.path.join(CURRENT_DIR, 'output')) cls.gal.build_paths()
def test_theme_path(tmpdir): """Test that image size is swaped if needed.""" tmpdir.join('theme').mkdir() tmpdir.join('theme').join('templates').mkdir() conf = tmpdir.join('sigal.conf.py') conf.write("theme = 'theme'") settings = read_settings(str(conf)) assert settings['theme'] == tmpdir.join('theme')
def test_gallery(tmpdir): "Test the Gallery class." default_conf = os.path.join(SAMPLE_DIR, 'sigal.conf.py') settings = read_settings(default_conf) settings['destination'] = str(tmpdir) gal = Gallery(settings, ncpu=1) gal.build() out_html = os.path.join(settings['destination'], 'index.html') assert os.path.isfile(out_html) with open(out_html, 'r') as f: html = f.read() assert '<title>Sigal test gallery</title>' in html
def settings(): """Read the sample config file.""" return read_settings(os.path.join(CURRENT_DIR, 'sample', 'sigal.conf.py'))
def make_gallery(**kwargs): default_conf = os.path.join(SAMPLE_DIR, 'sigal.conf.py') settings = read_settings(default_conf) settings['source'] = SAMPLE_SOURCE settings.update(kwargs) return Gallery(settings)
def make_gallery(**kwargs): default_conf = os.path.join(SAMPLE_DIR, 'sigal.conf.py') settings = read_settings(default_conf) settings['source'] = SAMPLE_SOURCE settings.update(kwargs) return Gallery(settings, ncpu=1)
def settings(): """Read the sample config file.""" path = os.path.abspath(os.path.dirname(__file__)) return read_settings(os.path.join(path, 'sample', 'sigal.conf.py'))
def setUp(self): "Read the sample config file" self.path = os.path.abspath(os.path.dirname(__file__)) default_conf = os.path.join(self.path, 'sample', 'sigal.conf.py') self.settings = read_settings(default_conf)