Feat: Enable configfile loading
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import os
|
||||
import pytest
|
||||
|
||||
from bopytex.planner import fake_planner
|
||||
from bopytex.service import orcherstrator
|
||||
from bopytex.service import get_config, orcherstrator
|
||||
from bopytex.tasks import Task
|
||||
from bopytex.worker import Dispatcher
|
||||
from .fakes.workers import fake_worker
|
||||
@@ -14,3 +17,43 @@ def test_service():
|
||||
for i, message in enumerate(service):
|
||||
assert message.status == 0
|
||||
assert message.out == [f"FAKE - {{'number': {i}}} - [] - {i}"]
|
||||
|
||||
|
||||
def test_get_config_no_configfile():
|
||||
pass
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def config_file(tmp_path):
|
||||
config_file = tmp_path / "bopytex_config.py"
|
||||
with open(config_file, "w") as f:
|
||||
f.write(
|
||||
"""
|
||||
from bopytex.jinja2_env.texenv import texenv
|
||||
jinja2 = {
|
||||
"environment": texenv,
|
||||
}
|
||||
"""
|
||||
)
|
||||
return config_file
|
||||
|
||||
|
||||
def test_get_config_with_configfile(config_file, tmp_path):
|
||||
os.chdir(tmp_path)
|
||||
config = get_config({"from_option": "config", "configfile": str(config_file)})
|
||||
assert type(config) == dict
|
||||
assert set(config.keys()) == {
|
||||
"generate",
|
||||
"configfile",
|
||||
"Dispatcher",
|
||||
"planner",
|
||||
"latexmk",
|
||||
"clean",
|
||||
"j2",
|
||||
"dispatcher",
|
||||
"pdfjam",
|
||||
"jinja2",
|
||||
"texenv",
|
||||
"from_option",
|
||||
}
|
||||
assert list(config["jinja2"].keys()) == ["environment"]
|
||||
|
||||
Reference in New Issue
Block a user