Refact: move bopytex.bopytex to service.main
This commit is contained in:
parent
467135abc6
commit
0d614465f0
@ -5,7 +5,7 @@
|
|||||||
import click
|
import click
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from bopytex.bopytex import bopytex
|
from bopytex.service import main
|
||||||
|
|
||||||
formatter = logging.Formatter("%(name)s :: %(levelname)s :: %(message)s")
|
formatter = logging.Formatter("%(name)s :: %(levelname)s :: %(message)s")
|
||||||
steam_handler = logging.StreamHandler()
|
steam_handler = logging.StreamHandler()
|
||||||
@ -78,7 +78,7 @@ logger.addHandler(steam_handler)
|
|||||||
help="Create and compile correction while making subjects",
|
help="Create and compile correction while making subjects",
|
||||||
)
|
)
|
||||||
def new(**options):
|
def new(**options):
|
||||||
for message in bopytex(**options):
|
for message in main(**options):
|
||||||
try:
|
try:
|
||||||
assert message.status == 0
|
assert message.status == 0
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
|
@ -6,6 +6,7 @@ Producing then compiling templates
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from bopytex.scheduler import Scheduler
|
from bopytex.scheduler import Scheduler
|
||||||
|
import bopytex.default_config as DEFAULT
|
||||||
|
|
||||||
|
|
||||||
def orcherstrator(
|
def orcherstrator(
|
||||||
@ -21,6 +22,17 @@ def orcherstrator(
|
|||||||
for message in scheduler.backlog():
|
for message in scheduler.backlog():
|
||||||
yield message
|
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'
|
# Reglages pour 'vim'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import jinja2
|
import jinja2
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from bopytex.bopytex import bopytex
|
from bopytex.service import main
|
||||||
import pytest
|
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
|
pass
|
||||||
|
|
||||||
assert Path("joined_source.pdf").exists()
|
assert Path("joined_source.pdf").exists()
|
||||||
|
Loading…
Reference in New Issue
Block a user