Feat: use and test csv files
This commit is contained in:
6
test/students.csv
Normal file
6
test/students.csv
Normal file
@@ -0,0 +1,6 @@
|
||||
nom,classe,elo
|
||||
Bob,1ST,1000
|
||||
Pipo,1ST,1300
|
||||
Popi,1ST,100
|
||||
Boule,1ST,4000
|
||||
Bill,1ST,1300
|
||||
|
@@ -9,7 +9,8 @@ from shutil import copyfile
|
||||
from bopytex import produce_and_compile
|
||||
|
||||
SNIPPETS_PATH = Path("snippets/")
|
||||
TEST_TEMPLATE_PATH = Path("test/templates/")
|
||||
TEST_PATH = Path("test")
|
||||
TEST_TEMPLATE_PATH = TEST_PATH / "templates/"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -22,6 +23,9 @@ def prepare_test_template(tmp_path):
|
||||
snippets = TEST_TEMPLATE_PATH.glob("tpl_*.tex")
|
||||
for s in snippets:
|
||||
copyfile(s, tmp / s.name)
|
||||
csvs = TEST_PATH.glob("*.csv")
|
||||
for s in csvs:
|
||||
copyfile(s, tmp / s.name)
|
||||
|
||||
prev_dir = Path.cwd()
|
||||
os.chdir(tmp)
|
||||
@@ -66,6 +70,25 @@ def test_produce_and_compile_base(prepare_test_template):
|
||||
)
|
||||
|
||||
|
||||
def test_produce_and_compile_csv(prepare_test_template):
|
||||
test_tpl = list(Path(".").glob("tpl_*.tex"))
|
||||
assert [tpl.name for tpl in test_tpl] == ["tpl_test.tex"]
|
||||
for tpl in test_tpl:
|
||||
produce_and_compile(
|
||||
{
|
||||
"template": tpl,
|
||||
"working_dir": None,
|
||||
"only_corr": False,
|
||||
"students_csv": "students.csv",
|
||||
"number_subjects": 1,
|
||||
"dirty": False,
|
||||
"no_compile": False,
|
||||
"no_join": False,
|
||||
"corr": False,
|
||||
"crazy": False,
|
||||
}
|
||||
)
|
||||
|
||||
def test_pdfjoin_current_directory(prepare_test_template):
|
||||
wdir = prepare_test_template
|
||||
pass
|
||||
@@ -99,23 +122,23 @@ def test_activate_solution():
|
||||
pass
|
||||
|
||||
|
||||
def test_snippets(prepare_snippets):
|
||||
snippets = list(Path(".").glob("tpl_*.tex"))
|
||||
for tpl in snippets:
|
||||
produce_and_compile(
|
||||
{
|
||||
"template": tpl,
|
||||
"working_dir": None,
|
||||
"only_corr": False,
|
||||
"students_csv": None,
|
||||
"number_subjects": 1,
|
||||
"dirty": False,
|
||||
"no_compile": False,
|
||||
"no_join": False,
|
||||
"corr": False,
|
||||
"crazy": False,
|
||||
}
|
||||
)
|
||||
#def test_snippets(prepare_snippets):
|
||||
# snippets = list(Path(".").glob("tpl_*.tex"))
|
||||
# for tpl in snippets:
|
||||
# produce_and_compile(
|
||||
# {
|
||||
# "template": tpl,
|
||||
# "working_dir": None,
|
||||
# "only_corr": False,
|
||||
# "students_csv": None,
|
||||
# "number_subjects": 1,
|
||||
# "dirty": False,
|
||||
# "no_compile": False,
|
||||
# "no_join": False,
|
||||
# "corr": False,
|
||||
# "crazy": False,
|
||||
# }
|
||||
# )
|
||||
|
||||
|
||||
# -----------------------------
|
||||
|
||||
Reference in New Issue
Block a user