48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
|
#!/usr/bin/env python
|
||
|
# encoding: utf-8
|
||
|
|
||
|
from pytex import feed, pdflatex, clean
|
||
|
import os
|
||
|
|
||
|
TESTDIR = "tests"
|
||
|
GOOD_TEMPLATE = TESTDIR + "/tpl_good.tex"
|
||
|
WRONG_TEMPLATE = TESTDIR + "/tpl_wrong.tex"
|
||
|
|
||
|
GOOD_DATA = {
|
||
|
"name": "Bob",
|
||
|
"repetitions": 4,
|
||
|
}
|
||
|
|
||
|
def test_feed_once():
|
||
|
output = feed(GOOD_TEMPLATE, GOOD_DATA)
|
||
|
os.system(f"rm {output}")
|
||
|
|
||
|
def test_feed_twice():
|
||
|
output1 = feed(GOOD_TEMPLATE, GOOD_DATA)
|
||
|
output2 = feed(GOOD_TEMPLATE, GOOD_DATA)
|
||
|
os.system(f"rm {output1}")
|
||
|
os.system(f"rm {output2}")
|
||
|
|
||
|
def test_feed_output():
|
||
|
dest = "./tests/special_name.tex"
|
||
|
output = feed(GOOD_TEMPLATE, GOOD_DATA, dest)
|
||
|
assert(output.samefile(dest))
|
||
|
os.system(f"rm {output}")
|
||
|
|
||
|
def test_feed_output_noforce():
|
||
|
pass
|
||
|
# output = feed(GOOD_TEMPLATE, GOOD_DATA, )
|
||
|
# os.system(f"rm {output}")
|
||
|
|
||
|
def test_feed_pdflatex():
|
||
|
latex_file = feed(GOOD_TEMPLATE, GOOD_DATA)
|
||
|
pdflatex(latex_file)
|
||
|
os.system(f"rm {latex_file}")
|
||
|
clean(TESTDIR, ["*.aux", "*.log", "*.pdf"])
|
||
|
|
||
|
|
||
|
# -----------------------------
|
||
|
# Reglages pour 'vim'
|
||
|
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
||
|
# cursor: 16 del
|