Commit 9bce8563 authored by Cornee Traas's avatar Cornee Traas
Browse files

Add latex generator

parent 60b39d56
......@@ -6,6 +6,7 @@ omit =
eit_dashboard/wsgi.py
tests/*
*/migrations/*
collectpytest.py
[report]
fail_under = 100
......@@ -105,3 +105,5 @@ venv.bak/
# editor configs
.vscode/
*.tex
\ No newline at end of file
# contents of runpytest.py
import sys
import pytest
class MyPlugin:
def __init__(self):
self.collected = []
def pytest_collection_modifyitems(self, items):
for item in items:
self.collected.append(item.nodeid)
my_plugin = MyPlugin()
pytest.main(["--collect-only", "-p", "no:terminal"], plugins=[my_plugin])
file = open("test-backend.tex", "w+")
currentname = ""
file.write("\\documentclass[preview]{standalone}\n \\begin{document}\n")
for nodeid in my_plugin.collected:
id = nodeid.split("::")
filename = id[0].replace("_", "\\_")
functionname = id[1].replace("_", " ").replace("[", " ").replace("]", "")
if filename != currentname:
if currentname != "":
file.write("\\end{itemize}\n")
currentname = filename
file.write("\\subsection{" + filename + "}\n\\begin{itemize}\n")
file.write("\\item " + functionname + "\n")
print(nodeid)
file.write("\\end{itemize}\n\\end{document}\n")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment