from pygitweb.api.action import Action
from pygitweb.api.project import Project
from fastapi import Request
import subprocess
def ActionPytestHtml(Action):
"""
ActionPytestHtml: Run pytest and render the results.
"""
def action_name(self) -> str:
return "pytesthtml_run"
def action(self, project: Project, user: request: Request = None) -> None:
subprocess.run(["pytest", "--html=.pygitweb/pytest_report.html", "--self-contained-html"], cwd=project.path)