Example #1
0
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'])
Example #2
0
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'])
Example #3
0
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)
Example #4
0
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)
Example #5
0
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)
Example #6
0
    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()
Example #7
0
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')
Example #8
0
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')
Example #9
0
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
Example #10
0
def settings():
    """Read the sample config file."""
    return read_settings(os.path.join(CURRENT_DIR, 'sample', 'sigal.conf.py'))
Example #11
0
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)
Example #12
0
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)
Example #13
0
def settings():
    """Read the sample config file."""
    return read_settings(os.path.join(CURRENT_DIR, 'sample', 'sigal.conf.py'))
Example #14
0
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'))
Example #15
0
 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)