Refact: move bopytex.bopytex to service.main

This commit is contained in:
Bertrand Benjamin 2022-05-04 21:16:27 +02:00
parent 467135abc6
commit 0d614465f0
3 changed files with 16 additions and 4 deletions

View File

@ -5,7 +5,7 @@
import click
import logging
from bopytex.bopytex import bopytex
from bopytex.service import main
formatter = logging.Formatter("%(name)s :: %(levelname)s :: %(message)s")
steam_handler = logging.StreamHandler()
@ -78,7 +78,7 @@ logger.addHandler(steam_handler)
help="Create and compile correction while making subjects",
)
def new(**options):
for message in bopytex(**options):
for message in main(**options):
try:
assert message.status == 0
except AssertionError:

View File

@ -6,6 +6,7 @@ Producing then compiling templates
"""
from bopytex.scheduler import Scheduler
import bopytex.default_config as DEFAULT
def orcherstrator(
@ -21,6 +22,17 @@ def orcherstrator(
for message in scheduler.backlog():
yield message
def main(**options):
config = options.copy()
config["jinja2"] = {}
config["jinja2"]["environment"] = DEFAULT.jinja2_env
orcherstre = orcherstrator(
config, planner=DEFAULT.planner, dispatcher=DEFAULT.dispatcher
)
for message in orcherstre:
yield message
# -----------------------------
# Reglages pour 'vim'

View File

@ -1,7 +1,7 @@
import os
import jinja2
from pathlib import Path
from bopytex.bopytex import bopytex
from bopytex.service import main
import pytest
@ -43,7 +43,7 @@ def test_with_default_planner(template_path, jinja2_env, tmp_path):
},
}
for message in bopytex(**options):
for message in main(**options):
pass
assert Path("joined_source.pdf").exists()