test the high level SSG build command
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
parent
dd2f5eeaea
commit
7b2bf6905a
@ -22,7 +22,7 @@ jinja_env = Environment(
|
||||
try:
|
||||
# packaged/pip install -e . value
|
||||
from ._version import version as __version__
|
||||
except ImportError:
|
||||
except ImportError: # pragma: no cover
|
||||
# local clone value
|
||||
from setuptools_scm import get_version
|
||||
__version__ = get_version(root='..', relative_to=__file__)
|
||||
|
||||
@ -129,3 +129,26 @@ def test_build_in_destination_ignores_dot_files():
|
||||
generator.build_in_destination(os.path.join(src_dir, 'pages'), tmpdir)
|
||||
|
||||
assert not os.path.exists(os.path.join(tmpdir, '.ignored-file.md'))
|
||||
|
||||
|
||||
def test_build():
|
||||
"""Test that the high level build can work against two directories."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
src_dir = os.path.join(HERE, 'instance')
|
||||
generator = ssg.StaticSiteGenerator(src_dir, tmpdir)
|
||||
generator.build()
|
||||
|
||||
assert os.path.exists(os.path.join(tmpdir, 'index.md'))
|
||||
assert os.path.exists(os.path.join(tmpdir, 'index.html'))
|
||||
assert os.path.exists(os.path.join(tmpdir, 'subdir', 'index.md'))
|
||||
assert os.path.exists(os.path.join(tmpdir, 'subdir', 'index.html'))
|
||||
assert os.path.exists(os.path.join(tmpdir, 'symlink-to-subdir'))
|
||||
assert os.path.isdir(os.path.join(tmpdir, 'symlink-to-subdir'))
|
||||
assert os.path.islink(os.path.join(tmpdir, 'symlink-to-subdir'))
|
||||
assert os.path.exists(os.path.join(tmpdir, 'media'))
|
||||
assert os.path.isdir(os.path.join(tmpdir, 'media'))
|
||||
assert not os.path.exists(os.path.join(tmpdir, '.ignored-file.md'))
|
||||
assert os.path.exists(os.path.join(tmpdir, 'feed'))
|
||||
assert os.path.isdir(os.path.join(tmpdir, 'feed'))
|
||||
assert os.path.exists(os.path.join(tmpdir, 'feed/atom'))
|
||||
assert os.path.exists(os.path.join(tmpdir, 'feed/rss'))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user