Add ability to trace API validator script (off by default)

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2025-05-31 10:08:54 +02:00
parent 49aa55e9c2
commit 5d3972a54d
2 changed files with 35 additions and 5 deletions

View File

@@ -9,13 +9,17 @@
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
import sys
import trace
from libs.openAPI import openApi
from libs.FTLAPI import FTLAPI
from libs.responseVerifyer import ResponseVerifyer
if __name__ == "__main__":
TRACE = False
def main():
# OpenAPI specs are split into multiple files, this script extracts the endpoints from them
openapi = openApi(base_path = "src/api/docs/content/specs/", api_root = "/api")
openapi = openApi(base_path = "src/api/docs/content/specs/", api_root = "/api", trace = TRACE)
if not openapi.parse("main.yaml"):
exit(1)
@@ -110,4 +114,22 @@ if __name__ == "__main__":
# If there are no errors, exit with success
print("Everything okay!")
exit(0)
#exit(0)
if __name__ == "__main__":
if TRACE:
tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
trace=1, count=1)
tracer.run('main()')
# make a report, placing output in the current directory
r = tracer.results()
print(r.write_results(show_missing=True, coverdir="."))
# Exit with success
exit(0)
else:
main()
# Exit with success
exit(0)