1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 12:42:41 +00:00

Don't use internal templates anymore.

Blag will throw an error if a template is not found locally. The error
message contains an explanation for the user on where to get the missing
templates.

Quickstart will generate templates for the user in the working
directory.

Updated tests appropriately.
This commit is contained in:
Bastian Venthur
2023-06-01 13:35:33 +02:00
parent a3572d414f
commit c952c574b7
6 changed files with 88 additions and 33 deletions

View File

@@ -179,9 +179,9 @@ author = a. u. thor
assert config_parsed['base_url'] == 'https://example.com/'
def test_environment_factory() -> None:
def test_environment_factory(cleandir: str) -> None:
globals_: dict[str, object] = {'foo': 'bar', 'test': 'me'}
env = blag.environment_factory(globals_=globals_)
env = blag.environment_factory("templates", globals_=globals_)
assert env.globals['foo'] == 'bar'
assert env.globals['test'] == 'me'
@@ -299,6 +299,22 @@ foo bar
assert os.path.exists(f'{args.output_dir}/tags/bar.html')
@pytest.mark.parametrize(
'template',
[
'page.html',
'article.html',
'archive.html',
'tags.html',
'tag.html',
]
)
def test_missing_template_raises(template: str, args: Namespace) -> None:
os.remove(f'templates/{template}')
with pytest.raises(SystemExit):
blag.build(args)
def test_main(cleandir: str) -> None:
blag.main(['build'])