mirror of
https://github.com/karma-riuk/crab.git
synced 2025-07-05 05:28:13 +02:00
now extracting the number of tests for gradle as well
This commit is contained in:
14
handlers.py
14
handlers.py
@ -1,5 +1,6 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import os, re, docker, subprocess
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
USER_ID = os.getuid() # for container user
|
||||
GROUP_ID = os.getgid()
|
||||
@ -183,6 +184,19 @@ class GradleHandler(BuildHandler):
|
||||
self.updates["n_tests_errors"] = -1
|
||||
self.updates["n_tests_skipped"] = -1
|
||||
|
||||
# Load the HTML file
|
||||
with open(os.path.join(self.path, "build/reports/tests/test/index.html"), "r", encoding="utf-8") as file:
|
||||
soup = BeautifulSoup(file, "html.parser")
|
||||
|
||||
# Extract total tests
|
||||
self.updates["n_tests"] = int(soup.find("div", class_="infoBox", id="tests").find("div", class_="counter").text.strip())
|
||||
|
||||
# Extract failed tests
|
||||
self.updates["n_tests_failed"] = int(soup.find("div", class_="infoBox", id="failures").find("div", class_="counter").text.strip())
|
||||
|
||||
# Calculate passed tests
|
||||
self.updates["n_tests_passed"] = self.updates["n_tests"] - self.updates["n_tests_failed"]
|
||||
|
||||
def merge_download_lines(lines: list) -> list:
|
||||
"""
|
||||
Merges lines that are part of the same download block in Maven output.
|
||||
|
Reference in New Issue
Block a user