ScriptCollection 3.4.11__py3-none-any.whl → 3.4.13__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.
- ScriptCollection/ScriptCollectionCore.py +1 -1
- ScriptCollection/TasksForCommonProjectStructure.py +29 -13
- {ScriptCollection-3.4.11.dist-info → ScriptCollection-3.4.13.dist-info}/METADATA +1 -1
- {ScriptCollection-3.4.11.dist-info → ScriptCollection-3.4.13.dist-info}/RECORD +7 -7
- {ScriptCollection-3.4.11.dist-info → ScriptCollection-3.4.13.dist-info}/WHEEL +0 -0
- {ScriptCollection-3.4.11.dist-info → ScriptCollection-3.4.13.dist-info}/entry_points.txt +0 -0
- {ScriptCollection-3.4.11.dist-info → ScriptCollection-3.4.13.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
from datetime import datetime
|
|
2
3
|
from graphlib import TopologicalSorter
|
|
3
4
|
import os
|
|
@@ -10,6 +11,8 @@ import urllib.request
|
|
|
10
11
|
import zipfile
|
|
11
12
|
import json
|
|
12
13
|
import configparser
|
|
14
|
+
import tempfile
|
|
15
|
+
import uuid
|
|
13
16
|
import requests
|
|
14
17
|
from packaging import version
|
|
15
18
|
import xmlschema
|
|
@@ -175,15 +178,20 @@ class TasksForCommonProjectStructure:
|
|
|
175
178
|
@GeneralUtilities.check_arguments
|
|
176
179
|
def check_testcoverage(self, testcoverage_file_in_cobertura_format: str, repository_folder: str, codeunitname: str):
|
|
177
180
|
root: etree._ElementTree = etree.parse(testcoverage_file_in_cobertura_format)
|
|
178
|
-
|
|
181
|
+
if len(root.xpath('//coverage/packages/package')) != 1:
|
|
182
|
+
raise ValueError(f"'{testcoverage_file_in_cobertura_format}' must contain exactly 1 package.")
|
|
183
|
+
if root.xpath('//coverage/packages/package[1]/@name')[0] != codeunitname:
|
|
184
|
+
raise ValueError(f"The package name of the tested package in '{testcoverage_file_in_cobertura_format}' must be '{codeunitname}'.")
|
|
179
185
|
coverage_in_percent = round(float(str(root.xpath('//coverage/@line-rate')[0]))*100, 2)
|
|
186
|
+
technicalminimalrequiredtestcoverageinpercent = 0
|
|
187
|
+
if not technicalminimalrequiredtestcoverageinpercent < coverage_in_percent:
|
|
188
|
+
raise ValueError(f"The test-coverage of package '{codeunitname}' must be greater than {technicalminimalrequiredtestcoverageinpercent}%.")
|
|
180
189
|
codeunit_file = os.path.join(repository_folder, codeunitname, f"{codeunitname}.codeunit.xml")
|
|
181
190
|
minimalrequiredtestcoverageinpercent = self.get_testcoverage_threshold_from_codeunit_file(codeunit_file)
|
|
182
191
|
minimalrecommendedcoverage = 80
|
|
183
192
|
if minimalrequiredtestcoverageinpercent < minimalrecommendedcoverage:
|
|
184
193
|
GeneralUtilities.write_message_to_stderr(f"Warning: The minimal required testcoverage is {minimalrequiredtestcoverageinpercent}% " +
|
|
185
194
|
f"but should be at least {minimalrecommendedcoverage}%.")
|
|
186
|
-
# TODO check that testcoverage_file_in_cobertura_format contains at least one package with at least one line of code
|
|
187
195
|
if (coverage_in_percent < minimalrequiredtestcoverageinpercent):
|
|
188
196
|
raise ValueError(f"The testcoverage for codeunit {codeunitname} must be {minimalrequiredtestcoverageinpercent}% or more but is {coverage_in_percent}%.")
|
|
189
197
|
|
|
@@ -221,7 +229,7 @@ class TasksForCommonProjectStructure:
|
|
|
221
229
|
GeneralUtilities.ensure_file_does_not_exist(coveragefile)
|
|
222
230
|
os.rename(os.path.join(repository_folder, codeunitname, "coverage.xml"), coveragefile)
|
|
223
231
|
self.update_path_of_source(repository_folder, codeunitname)
|
|
224
|
-
self.run_testcases_common_post_task(repository_folder, codeunitname, verbosity,
|
|
232
|
+
self.run_testcases_common_post_task(repository_folder, codeunitname, verbosity, generate_badges, targetenvironmenttype, commandline_arguments)
|
|
225
233
|
|
|
226
234
|
def copy_source_files_to_output_directory(self, buildscript_file: str):
|
|
227
235
|
sc = ScriptCollectionCore()
|
|
@@ -599,9 +607,9 @@ class TasksForCommonProjectStructure:
|
|
|
599
607
|
sarif_filename = f"{csproj_file_name_without_extension}.sarif"
|
|
600
608
|
sarif_source_file = os.path.join(sarif_folder, sarif_filename)
|
|
601
609
|
if os.path.exists(sarif_source_file):
|
|
602
|
-
|
|
603
|
-
GeneralUtilities.ensure_directory_exists(
|
|
604
|
-
sarif_target_file = os.path.join(
|
|
610
|
+
sarif_folder_target = os.path.join(codeunit_folder, "Other", "Artifacts", "CodeAnalysisResult")
|
|
611
|
+
GeneralUtilities.ensure_directory_exists(sarif_folder_target)
|
|
612
|
+
sarif_target_file = os.path.join(sarif_folder_target, sarif_filename)
|
|
605
613
|
GeneralUtilities.ensure_file_does_not_exist(sarif_target_file)
|
|
606
614
|
shutil.copyfile(sarif_source_file, sarif_target_file)
|
|
607
615
|
GeneralUtilities.ensure_file_does_not_exist(sarif_source_file)
|
|
@@ -763,21 +771,25 @@ class TasksForCommonProjectStructure:
|
|
|
763
771
|
|
|
764
772
|
@GeneralUtilities.check_arguments
|
|
765
773
|
def standardized_tasks_run_testcases_for_dotnet_project(self, runtestcases_file: str, targetenvironmenttype: str, verbosity: int, generate_badges: bool,
|
|
766
|
-
commandline_arguments: list[str]):
|
|
774
|
+
target_environmenttype_mapping: dict[str, str], commandline_arguments: list[str]):
|
|
775
|
+
dotnet_build_configuration: str = target_environmenttype_mapping[targetenvironmenttype]
|
|
767
776
|
codeunit_name: str = os.path.basename(str(Path(os.path.dirname(runtestcases_file)).parent.parent.absolute()))
|
|
768
777
|
verbosity = TasksForCommonProjectStructure.get_verbosity_from_commandline_arguments(commandline_arguments, verbosity)
|
|
769
778
|
repository_folder: str = str(Path(os.path.dirname(runtestcases_file)).parent.parent.parent.absolute())
|
|
770
779
|
coverage_file_folder = os.path.join(repository_folder, codeunit_name, "Other/Artifacts/TestCoverage")
|
|
771
|
-
|
|
772
|
-
|
|
780
|
+
temp_folder = os.path.join(tempfile.gettempdir(), str(uuid.uuid4()))
|
|
781
|
+
GeneralUtilities.ensure_directory_exists(temp_folder)
|
|
773
782
|
runsettings_file = self.dotnet_runsettings_file
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
783
|
+
codeunit_folder = os.path.join(repository_folder, codeunit_name)
|
|
784
|
+
arg = f"collect dotnet test . -c {dotnet_build_configuration} -o {temp_folder}"
|
|
785
|
+
if os.path.isfile(os.path.join(codeunit_folder, runsettings_file)):
|
|
786
|
+
arg = f"{arg} --settings {runsettings_file}"
|
|
787
|
+
arg = f"{arg} /p:CollectCoverage=true /p:CoverletOutput=../Other/Artifacts/TestCoverage/Testcoverage /p:CoverletOutputFormat=cobertura"
|
|
788
|
+
self.__sc.run_program("dotnet-coverage", arg, codeunit_folder, verbosity=verbosity)
|
|
778
789
|
os.rename(os.path.join(coverage_file_folder, "Testcoverage.cobertura.xml"), os.path.join(coverage_file_folder, "TestCoverage.xml"))
|
|
779
790
|
self.run_testcases_common_post_task(repository_folder, codeunit_name, verbosity, generate_badges, targetenvironmenttype, commandline_arguments)
|
|
780
791
|
|
|
792
|
+
@GeneralUtilities.check_arguments
|
|
781
793
|
def run_testcases_common_post_task(self, repository_folder: str, codeunit_name: str, verbosity: int, generate_badges: bool,
|
|
782
794
|
targetenvironmenttype: str, commandline_arguments: list[str]):
|
|
783
795
|
coverage_file_folder = os.path.join(repository_folder, codeunit_name, "Other/Artifacts/TestCoverage")
|
|
@@ -1655,6 +1667,10 @@ class TasksForCommonProjectStructure:
|
|
|
1655
1667
|
verbosity = self.get_verbosity_from_commandline_arguments(cmd_args, verbosity)
|
|
1656
1668
|
codeunit_folder = GeneralUtilities.resolve_relative_path("..", os.path.dirname(update_script_file))
|
|
1657
1669
|
codeunit_name = os.path.basename(codeunit_folder)
|
|
1670
|
+
|
|
1671
|
+
build_folder = os.path.join(codeunit_folder, "Other", "Build")
|
|
1672
|
+
self.__sc.run_program("python", "Build.py", build_folder)
|
|
1673
|
+
|
|
1658
1674
|
csproj_file = os.path.join(codeunit_folder, codeunit_name, f"{codeunit_name}.csproj")
|
|
1659
1675
|
self.__sc.update_dependencies_of_dotnet_project(csproj_file, verbosity)
|
|
1660
1676
|
test_csproj_file = os.path.join(codeunit_folder, f"{codeunit_name}Tests", f"{codeunit_name}Tests.csproj")
|
|
@@ -3,12 +3,12 @@ ScriptCollection/GeneralUtilities.py,sha256=-cGK5Df6aHQe0A6oQzEoD53AMtwGHXBdOeRC
|
|
|
3
3
|
ScriptCollection/ProgramRunnerBase.py,sha256=2kyOuoM3oFjBfLc9Q5t5RTz7Ya2CjUxFtB1rBBDmnjU,1937
|
|
4
4
|
ScriptCollection/ProgramRunnerEpew.py,sha256=nIzY4dG6W-xEpkeoTbozwNZtFSIo-bU_W6t6u1AZKtE,6275
|
|
5
5
|
ScriptCollection/ProgramRunnerPopen.py,sha256=HOs1QVnXiQtwXy1_xvH79bWBdd0i-2tUyyLloQBvMto,3023
|
|
6
|
-
ScriptCollection/ScriptCollectionCore.py,sha256=
|
|
7
|
-
ScriptCollection/TasksForCommonProjectStructure.py,sha256=
|
|
6
|
+
ScriptCollection/ScriptCollectionCore.py,sha256=yrXto_eYhx44Rt8MRX4ircsHV67KfXtg7dJ5y3820U8,94476
|
|
7
|
+
ScriptCollection/TasksForCommonProjectStructure.py,sha256=6n_VkTpoq_gxWPjPsLxlhthmcXyhKC6DXtSJZENSmOo,146510
|
|
8
8
|
ScriptCollection/UpdateCertificates.py,sha256=Go-JJK-YTi7aBB1phlLxypa8GHkmFHBEPB0_TT9G-bw,7918
|
|
9
9
|
ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
ScriptCollection-3.4.
|
|
11
|
-
ScriptCollection-3.4.
|
|
12
|
-
ScriptCollection-3.4.
|
|
13
|
-
ScriptCollection-3.4.
|
|
14
|
-
ScriptCollection-3.4.
|
|
10
|
+
ScriptCollection-3.4.13.dist-info/METADATA,sha256=CcNttz1EPCsw_Len7jiIPslvz0bFxxZ-HIwVa7gYM8U,7615
|
|
11
|
+
ScriptCollection-3.4.13.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
|
|
12
|
+
ScriptCollection-3.4.13.dist-info/entry_points.txt,sha256=dJKdWcH41owxlKx_khj4P7DItr9lhxWP9JU2Dq8GSsQ,2088
|
|
13
|
+
ScriptCollection-3.4.13.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
|
|
14
|
+
ScriptCollection-3.4.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|