From 6828fe684d4f2bf01531b0cf174d432a19687fa2 Mon Sep 17 00:00:00 2001 From: "ry.yamafuji" Date: Fri, 5 Dec 2025 00:51:08 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E6=95=B0=E3=81=AE=E5=88=B6=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/example.py | 4 +++- scripts/generate_coverage.py | 23 +++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/examples/example.py b/examples/example.py index 0976ae4..db7d631 100644 --- a/examples/example.py +++ b/examples/example.py @@ -1,7 +1,9 @@ import sys import os -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src"))) +sys.path.append( + os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")) +) from utils.custom_logger import get_logger diff --git a/scripts/generate_coverage.py b/scripts/generate_coverage.py index a2e57d6..79d6c21 100644 --- a/scripts/generate_coverage.py +++ b/scripts/generate_coverage.py @@ -5,7 +5,9 @@ class GenerateCoverage: """カバレッジ結果を解析して Markdown テーブルを生成""" def __init__( - self, coverage_file="pytest-coverage.txt", output_file="coverage_table.md" + self, + coverage_file="pytest-coverage.txt", + output_file="coverage_table.md", ): """ 初期化 @@ -38,18 +40,23 @@ class GenerateCoverage: continue # Coverage セクションの終わりを検出(TOTAL行の次の空行) if in_coverage_section and ( - line.strip().startswith("TOTAL") or line.strip().startswith("=") + line.strip().startswith("TOTAL") + or line.strip().startswith("=") ): break # Coverage データを抽出 if in_coverage_section: - match = re.match(r"(.+?)\s+(\d+)\s+(\d+)\s+(\d+%)\s*(.*)", line) + match = re.match( + r"(.+?)\s+(\d+)\s+(\d+)\s+(\d+%)\s*(.*)", line + ) if match: filename = match.group(1).strip() statements = match.group(2).strip() missed = match.group(3).strip() coverage = match.group(4).strip() - missing_lines = match.group(5).strip() if match.group(5) else "-" + missing_lines = ( + match.group(5).strip() if match.group(5) else "-" + ) coverage_info.append( { "filename": filename, @@ -71,8 +78,12 @@ class GenerateCoverage: print("Parsed coverage data.") # Markdown テーブルヘッダー - table_header = "| File | Statements | Missed | Coverage | Missing Lines |\n" - table_header += "|------|------------|--------|----------|---------------|\n" + table_header = ( + "| File | Statements | Missed | Coverage | Missing Lines |\n" + ) + table_header += ( + "|------|------------|--------|----------|---------------|\n" + ) # テーブル行を生成 table_rows = [