1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00

reformatted code

This commit is contained in:
Bastian Venthur
2023-06-16 10:25:21 +02:00
parent f6c5eaf375
commit 0349bd3359
11 changed files with 381 additions and 380 deletions

View File

@@ -1,9 +1,10 @@
# remove when we don't support py38 anymore
from __future__ import annotations
from argparse import Namespace
from typing import Iterator, Callable
from tempfile import TemporaryDirectory
import os
from argparse import Namespace
from tempfile import TemporaryDirectory
from typing import Callable, Iterator
import pytest
from jinja2 import Environment, Template
@@ -14,43 +15,43 @@ from blag import blag, quickstart
@pytest.fixture
def environment(cleandir: str) -> Iterator[Environment]:
site = {
'base_url': 'site base_url',
'title': 'site title',
'description': 'site description',
'author': 'site author',
"base_url": "site base_url",
"title": "site title",
"description": "site description",
"author": "site author",
}
env = blag.environment_factory('templates', globals_=dict(site=site))
env = blag.environment_factory("templates", globals_=dict(site=site))
yield env
@pytest.fixture
def page_template(environment: Environment) -> Iterator[Template]:
yield environment.get_template('page.html')
yield environment.get_template("page.html")
@pytest.fixture
def article_template(environment: Environment) -> Iterator[Template]:
yield environment.get_template('article.html')
yield environment.get_template("article.html")
@pytest.fixture
def index_template(environment: Environment) -> Iterator[Template]:
yield environment.get_template('index.html')
yield environment.get_template("index.html")
@pytest.fixture
def archive_template(environment: Environment) -> Iterator[Template]:
yield environment.get_template('archive.html')
yield environment.get_template("archive.html")
@pytest.fixture
def tags_template(environment: Environment) -> Iterator[Template]:
yield environment.get_template('tags.html')
yield environment.get_template("tags.html")
@pytest.fixture
def tag_template(environment: Environment) -> Iterator[Template]:
yield environment.get_template('tag.html')
yield environment.get_template("tag.html")
@pytest.fixture
@@ -65,8 +66,8 @@ author = a. u. thor
"""
with TemporaryDirectory() as dir:
os.mkdir(f'{dir}/build')
with open(f'{dir}/config.ini', 'w') as fh:
os.mkdir(f"{dir}/build")
with open(f"{dir}/config.ini", "w") as fh:
fh.write(config)
# change directory
old_cwd = os.getcwd()
@@ -79,11 +80,10 @@ author = a. u. thor
@pytest.fixture
def args(cleandir: Callable[[], Iterator[str]]) -> Iterator[Namespace]:
args = Namespace(
input_dir='content',
output_dir='build',
static_dir='static',
template_dir='templates',
input_dir="content",
output_dir="build",
static_dir="static",
template_dir="templates",
)
yield args