coverage-tool 1.0.1__py3-none-any.whl → 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ class GTestConverter(BaseConverter):
18
18
  # Google Test 支持直接输出 XML
19
19
  # 如果已经有 XML 文件,直接返回
20
20
  if os.path.exists(xml_path):
21
- with open(xml_path, 'r') as f:
21
+ with open(xml_path, 'r', encoding='utf-8') as f:
22
22
  return f.read()
23
23
 
24
24
  # 解析文本输出
coverage_tool/example.py CHANGED
@@ -14,7 +14,7 @@ def create_sample_python_project(project_dir):
14
14
  """创建一个示例Python项目"""
15
15
  # 创建主模块
16
16
  main_file = os.path.join(project_dir, "main.py")
17
- with open(main_file, 'w') as f:
17
+ with open(main_file, 'w', encoding='utf-8') as f:
18
18
  f.write("""
19
19
  def add(a, b):
20
20
  return a + b
@@ -28,7 +28,7 @@ def multiply(a, b):
28
28
 
29
29
  # 创建测试文件
30
30
  test_file = os.path.join(project_dir, "test_main.py")
31
- with open(test_file, 'w') as f:
31
+ with open(test_file, 'w', encoding='utf-8') as f:
32
32
  f.write("""
33
33
  import pytest
34
34
  from main import add, subtract, multiply
@@ -77,7 +77,7 @@ class CoverageExtractor:
77
77
  def _parse_go_coverage_file(coverage_out_path: str) -> float:
78
78
  """直接解析Go coverage.out文件"""
79
79
  try:
80
- with open(coverage_out_path, 'r') as f:
80
+ with open(coverage_out_path, 'r', encoding='utf-8') as f:
81
81
  lines = f.readlines()
82
82
 
83
83
  if not lines or not lines[0].startswith('mode:'):
@@ -108,7 +108,7 @@ class CoverageExtractor:
108
108
  def _extract_gcov_coverage(coverage_out_path: str) -> float:
109
109
  """提取gcov覆盖率"""
110
110
  try:
111
- with open(coverage_out_path, 'r') as f:
111
+ with open(coverage_out_path, 'r', encoding='utf-8') as f:
112
112
  content = f.read()
113
113
 
114
114
  # 尝试多种模式匹配
@@ -134,7 +134,7 @@ class CoverageExtractor:
134
134
  def _extract_generic_coverage(coverage_out_path: str) -> float:
135
135
  """通用覆盖率提取"""
136
136
  try:
137
- with open(coverage_out_path, 'r') as f:
137
+ with open(coverage_out_path, 'r', encoding='utf-8') as f:
138
138
  content = f.read()
139
139
 
140
140
  # 查找百分比
@@ -153,7 +153,7 @@ class CoverageExtractor:
153
153
  return 0.0
154
154
 
155
155
  try:
156
- with open(jacoco_html_path, 'r') as f:
156
+ with open(jacoco_html_path, 'r', encoding='utf-8') as f:
157
157
  content = f.read()
158
158
 
159
159
  # 查找Total行中的覆盖率
@@ -25,7 +25,7 @@ class CRunner(BaseRunner):
25
25
  xml_content = JUnitReportConverter.convert_generic_output(
26
26
  result.stdout + result.stderr, 'cunit'
27
27
  )
28
- with open(output_file, 'w') as f:
28
+ with open(output_file, 'w', encoding='utf-8') as f:
29
29
  f.write(xml_content)
30
30
  result.junit_xml_path = output_file
31
31
  except Exception as e:
@@ -25,7 +25,7 @@ class CPPRunner(BaseRunner):
25
25
  xml_content = JUnitReportConverter.convert_generic_output(
26
26
  result.stdout + result.stderr, 'gtest'
27
27
  )
28
- with open(output_file, 'w') as f:
28
+ with open(output_file, 'w', encoding='utf-8') as f:
29
29
  f.write(xml_content)
30
30
  result.junit_xml_path = output_file
31
31
  except Exception as e:
@@ -82,7 +82,7 @@ class GoRunner(BaseRunner):
82
82
  )
83
83
 
84
84
  if junit_result.returncode == 0 or junit_result.stdout:
85
- with open(output_file, 'w') as f:
85
+ with open(output_file, 'w', encoding='utf-8') as f:
86
86
  f.write(junit_result.stdout)
87
87
  result.junit_xml_path = output_file
88
88
  junit_xml_generated = True
@@ -96,7 +96,7 @@ class GoRunner(BaseRunner):
96
96
  if not junit_xml_generated:
97
97
  try:
98
98
  xml_content = JUnitReportConverter.convert_go_test(result.stdout)
99
- with open(output_file, 'w') as f:
99
+ with open(output_file, 'w', encoding='utf-8') as f:
100
100
  f.write(xml_content)
101
101
  result.junit_xml_path = output_file
102
102
  self.logger.info("[报告生成] ✓ 使用内置转换器生成 JUnit XML")
@@ -73,9 +73,9 @@ class JavaRunner(BaseRunner):
73
73
  tree = ET.ElementTree(testsuites_elem)
74
74
  tree.write(output_file, encoding='UTF-8', xml_declaration=False)
75
75
 
76
- with open(output_file, 'r') as f:
76
+ with open(output_file, 'r', encoding='utf-8') as f:
77
77
  content = f.read()
78
- with open(output_file, 'w') as f:
78
+ with open(output_file, 'w', encoding='utf-8') as f:
79
79
  f.write(xml_declaration + content)
80
80
 
81
81
  def _convert_surefire_reports(self, surefire_dir: str, output_file: str):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coverage-tool
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Multi-language unit test coverage analysis tool
5
5
  Author-email: Coverage Tool <coverage@tool.dev>
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  coverage_tool/__init__.py,sha256=0j2DaSgKbtKY7LShLYx8VHbAhD09gm8aGQI__uo4CeU,123
2
- coverage_tool/example.py,sha256=8d0VAve0F54wDXgKIpIgE5kn-ZzMEKDED6_74TfQMvo,2712
2
+ coverage_tool/example.py,sha256=EvY25Hfos49FU5BQp1Y5RaCJwyfNNlMx_Fcl4yD_5Pc,2748
3
3
  coverage_tool/main.py,sha256=kbxkhHdI6dRtkiPk_1naidVLqp3p-ClS-Eak3p_5EKo,19465
4
4
  coverage_tool/analyzers/__init__.py,sha256=GlcdK3CsmPtnGN0P13K0F6i-dMbL03wVRepIPW3U0O0,265
5
5
  coverage_tool/analyzers/dependency.py,sha256=l6HywXXdBY506F6yzaFH-aXYYrinbWKuG3LTfT2CGJc,18759
@@ -9,7 +9,7 @@ coverage_tool/converters/cunit_converter.py,sha256=_a9Tg_nSit6XlG7x7IA0oxjcGAJEK
9
9
  coverage_tool/converters/factory.py,sha256=Qzg4ZmfX9YeNx4BcPJu3n37XLcszy6ysu2B4NHs1-6w,1003
10
10
  coverage_tool/converters/generic_converter.py,sha256=35o6M5KyHxxOlX8al-nrN0dTT9v12PQF-Nc4hF7bHW8,1906
11
11
  coverage_tool/converters/go_converter.py,sha256=KoNQ4bqZrv1zeDuGWm7GUhri6QFMqolnG-GV0YIF490,6287
12
- coverage_tool/converters/gtest_converter.py,sha256=uTn65IvLEGy7OUTBk80uMx9o-mQ147Az0_Za7n575fI,1728
12
+ coverage_tool/converters/gtest_converter.py,sha256=GIkGe7bkKK8oJUBC1QhxNkgctjqDnPZo4vzDKEBs100,1746
13
13
  coverage_tool/core/__init__.py,sha256=rNM16navIyNkoMKVvJsEy2zVF7jAcyHV81nOsP1gKgI,415
14
14
  coverage_tool/core/config.py,sha256=QmBxj72gcwhI-bEUDMDd7mCUPxJdn7NiO7DdfingaOA,2133
15
15
  coverage_tool/core/reporter.py,sha256=GOsOhu8JX0u9sBHhEdbHHfrEFEfvFXQDVOyTLdeeD0w,9500
@@ -19,12 +19,12 @@ coverage_tool/handlers/env_checker.py,sha256=L6JJE39C-9DxKKtVC_ZUi-0ONxnjREZhQKi
19
19
  coverage_tool/parsers/__init__.py,sha256=7Wmg-Tf_rAo-uD9PWZJv5gGwSeWWuzcAAO2qMm6O3QE,264
20
20
  coverage_tool/parsers/junit.py,sha256=COjG9_YWvlAsX3Ztd11ttFRRDZnpjg-BZWWwr4egVTM,5555
21
21
  coverage_tool/runners/__init__.py,sha256=w-Lnwfh-4jOdjxdSepKO-YSg4GqHmPtK6Ut6wQeQkJU,584
22
- coverage_tool/runners/base.py,sha256=hyaFSIFoqW35O9Vou8iI3S2S0dTWCMvhn_92spz4lv0,8078
23
- coverage_tool/runners/c_runner.py,sha256=DZPtEVUZXSNQLuA1nDdI449ODImT1Tkfx8q28HyC_Ko,2166
24
- coverage_tool/runners/cpp_runner.py,sha256=f_L1FVuLRJH4DByj6Oo7uVGodOJFUDUEosZreqf70Ko,2154
22
+ coverage_tool/runners/base.py,sha256=bPsTFc1I-NCXKjJ0ILqYUoh54iAUylaR2dFnsUZfrYU,8150
23
+ coverage_tool/runners/c_runner.py,sha256=bAakBnI2gvuz0Cc8Paj84NJCECBe94VDOtBFv25GVgI,2184
24
+ coverage_tool/runners/cpp_runner.py,sha256=pormwZXQVRxdkceTjUNbXxYKp5-kYVP9vLW6qXyROXI,2172
25
25
  coverage_tool/runners/factory.py,sha256=f_oM_AQfj3Yge1Ou_XSyERbcynluBLWb4s85m7YgYWs,1187
26
- coverage_tool/runners/go_runner.py,sha256=FEOPpi-IMI5zu_zbzuaJ60vS0aoYJCTbRtW2q1TJEC0,6397
27
- coverage_tool/runners/java_runner.py,sha256=6qaSLZHPJGyo0Fh7Cm7wukRqkbrZEU7onXXVu-msCNk,3790
26
+ coverage_tool/runners/go_runner.py,sha256=3ZU3YJ5nOGHti2c-KfoX-7EQVSHBoXoDEuePPM6SCsE,6433
27
+ coverage_tool/runners/java_runner.py,sha256=yF-lMjQ2NzpOi1v9nVDBQqBLN3XM_DB4PiG1PPQK71M,3826
28
28
  coverage_tool/runners/python_runner.py,sha256=ZTOjY93ZY1vfuROM9-CX80d03AaAUA5fJhcprgWQ3Vk,3731
29
29
  coverage_tool/test_removers/__init__.py,sha256=rPbFy8DRohFctpZgBz-QR-mld0rxqBg4G4KHjKQqGgI,958
30
30
  coverage_tool/test_removers/base.py,sha256=LYvG0ZRcsbsI4p_h3HvwvStfO1-6i_ARzaupNFCE3BE,8911
@@ -40,8 +40,8 @@ coverage_tool/utils/file_backup.py,sha256=SSrVGAPlO-Lz4cx-dFLhRwonbL8V0h0siBm0ZP
40
40
  coverage_tool/utils/helpers.py,sha256=t2aWyMtV_r1EGFli40q1H1gGmibNrpjd5pFlhXNEX0w,2587
41
41
  coverage_tool/utils/logger.py,sha256=FGRPw39iXCT-VwrY4VOLpL_z2hALeYv4QAcYNC7SUsA,1596
42
42
  coverage_tool/utils/progress.py,sha256=o8t-FvrEMN4oYSK-cq_ywnkMES5szCwNhl546i0JpUU,1312
43
- coverage_tool-1.0.1.dist-info/METADATA,sha256=twNbEIpYw9OyirR45k5XmL37vP3ZV5JvG1s0OCS3X90,13751
44
- coverage_tool-1.0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
45
- coverage_tool-1.0.1.dist-info/entry_points.txt,sha256=gpUjpKt5x923IqF_YogfB-DMj_AhMyGivppNG61H7ig,58
46
- coverage_tool-1.0.1.dist-info/top_level.txt,sha256=QXoWKxLBHkNWJAlCFZjqCuunXV-6uWjUhc0ni4enaYo,14
47
- coverage_tool-1.0.1.dist-info/RECORD,,
43
+ coverage_tool-1.0.2.dist-info/METADATA,sha256=0aD4WA8aZJauxacL_rMmQuXQLz5DzYmK_qwEqsCHXGs,13751
44
+ coverage_tool-1.0.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
45
+ coverage_tool-1.0.2.dist-info/entry_points.txt,sha256=gpUjpKt5x923IqF_YogfB-DMj_AhMyGivppNG61H7ig,58
46
+ coverage_tool-1.0.2.dist-info/top_level.txt,sha256=QXoWKxLBHkNWJAlCFZjqCuunXV-6uWjUhc0ni4enaYo,14
47
+ coverage_tool-1.0.2.dist-info/RECORD,,