ScriptCollection 4.2.85__py3-none-any.whl → 4.2.86__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.
@@ -39,7 +39,7 @@ from .ProgramRunnerBase import ProgramRunnerBase
39
39
  from .ProgramRunnerPopen import ProgramRunnerPopen
40
40
  from .SCLog import SCLog, LogLevel
41
41
 
42
- version = "4.2.85"
42
+ version = "4.2.86"
43
43
  __version__ = version
44
44
 
45
45
  class VSCodeWorkspaceShellTask:
@@ -467,6 +467,10 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
467
467
  GeneralUtilities.ensure_directory_exists(temp_folder)
468
468
  runsettings_file = "runsettings.xml"
469
469
  codeunit_folder = f"{repository_folder}/{codeunit_name}"
470
+ GeneralUtilities.ensure_directory_exists(coverage_file_folder)
471
+ target_file = os.path.join(coverage_file_folder, "TestCoverage.xml")
472
+ GeneralUtilities.ensure_file_does_not_exist(target_file)
473
+
470
474
  args: list[str] = ["test", ".", "-c", dotnet_build_configuration]
471
475
  if os.path.isfile(os.path.join(codeunit_folder, runsettings_file)):
472
476
  args += ["--settings", runsettings_file]
@@ -482,10 +486,21 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
482
486
  if generated_coverage_file is not None:
483
487
  break
484
488
  GeneralUtilities.assert_condition(generated_coverage_file is not None, f"Coverage file 'coverage.cobertura.xml' was not found under '{temp_folder}'.")
485
- GeneralUtilities.ensure_directory_exists(coverage_file_folder)
486
- target_file = os.path.join(coverage_file_folder, "TestCoverage.xml")
487
- GeneralUtilities.ensure_file_does_not_exist(target_file)
488
489
  shutil.copyfile(generated_coverage_file, target_file)
490
+
491
+ if not self.__coverage_file_contains_sources_and_packages(target_file):
492
+ self._protected_sc.log.log("Coverage generated by XPlat collector is empty. Falling back to coverlet.msbuild coverage generation.")
493
+ GeneralUtilities.ensure_file_does_not_exist(target_file)
494
+ fallback_output = os.path.join(coverage_file_folder, "Testcoverage")
495
+ fallback_args: list[str] = ["test", ".", "-c", dotnet_build_configuration]
496
+ if os.path.isfile(os.path.join(codeunit_folder, runsettings_file)):
497
+ fallback_args += ["--settings", runsettings_file]
498
+ fallback_args += ["/p:CollectCoverage=true", "/p:CoverletOutputFormat=cobertura", f"/p:CoverletOutput={fallback_output}"]
499
+ self._protected_sc.run_program_argsasarray("dotnet", fallback_args, codeunit_folder, print_live_output=self.get_verbosity()==LogLevel.Debug, timeoutInSeconds=60*20)
500
+ fallback_file = f"{fallback_output}.cobertura.xml"
501
+ GeneralUtilities.ensure_file_exists(fallback_file)
502
+ shutil.copyfile(fallback_file, target_file)
503
+
489
504
  GeneralUtilities.ensure_directory_does_not_exist(temp_folder)
490
505
  self.__remove_unrelated_package_from_testcoverage_file(target_file, codeunit_name)
491
506
  root: etree._ElementTree = etree.parse(target_file)
@@ -512,6 +527,13 @@ class TFCPS_CodeUnitSpecific_DotNet_Functions(TFCPS_CodeUnitSpecific_Base):
512
527
  result = etree.tostring(root).decode("utf-8")
513
528
  GeneralUtilities.write_text_to_file(file, result)
514
529
 
530
+ @GeneralUtilities.check_arguments
531
+ def __coverage_file_contains_sources_and_packages(self, file: str) -> bool:
532
+ root: etree._ElementTree = etree.parse(file)
533
+ sources = root.xpath("//coverage/sources/source/text()")
534
+ packages = root.xpath("//coverage/packages/package")
535
+ return len(sources) > 0 and len(packages) > 0
536
+
515
537
  @GeneralUtilities.check_arguments
516
538
  def __standardized_tasks_run_testcases_for_dotnet_project_helper(self, source: str, codeunit_folder: str, match: re.Match) -> str:
517
539
  filename = match.group(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scriptcollection
3
- Version: 4.2.85
3
+ Version: 4.2.86
4
4
  Summary: The ScriptCollection is the place for reusable scripts.
5
5
  Author-email: Marius Göcke <marius.goecke@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/anionDev/ScriptCollection
@@ -15,7 +15,7 @@ ScriptCollection/ProgramRunnerMock.py,sha256=uTu-aFle1W_oKjeQEmuPsFPQpvo0kRf2FrR
15
15
  ScriptCollection/ProgramRunnerPopen.py,sha256=BPY7-ZMIlqT7JOKz8qlB5c0laF2Js-ijzqk09GxZC48,3821
16
16
  ScriptCollection/ProgramRunnerSudo.py,sha256=_khC3xuTdrPoLluBJZWfldltmmuKltABJPcbjZSFW-4,4835
17
17
  ScriptCollection/SCLog.py,sha256=8TRy1LeYMsPOIuWUcnUNNbO5pd-cNBS-3cn-kdzP8FU,4768
18
- ScriptCollection/ScriptCollectionCore.py,sha256=ggDiZ1EmfnoaIvkqi6Hod0T_cEDQdWg5Vf6ctR8IG64,189103
18
+ ScriptCollection/ScriptCollectionCore.py,sha256=quObk9xsjjdhQ0JfFusOx4y8thXgo-SJpWyhvkmuYKI,189103
19
19
  ScriptCollection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  ScriptCollection/OCIImages/AbstractImageHandler.py,sha256=o129UYDtLymCRjMZBP9Puaj19ueMHoNt6UTLspfnaRc,1758
21
21
  ScriptCollection/OCIImages/OCIImageManager.py,sha256=2muW4hJ_a7EfavY3WVnafqZ0HC87RcZsoTuNvA3c0To,11175
@@ -45,7 +45,7 @@ ScriptCollection/TFCPS/Docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
45
45
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationBase.py,sha256=bT6Gd5pQpZCw4OQz6HWkPCSn5z__eUUEisABLDSxd0o,200
46
46
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationGenerate.py,sha256=QyjOfMY22JWCvKjMelHiDWbJiWqotOfebpJpgDUaoO4,237
47
47
  ScriptCollection/TFCPS/DotNet/CertificateGeneratorInformationNoGenerate.py,sha256=i0zEGehj0sttxjjZtoq2KFSKp_ulxVyWp_ZgAhIY_So,241
48
- ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=2SiZZEhJGRLA5QgVCon0ctaIqyF9YuLaNqOCSgVvGUE,35620
48
+ ScriptCollection/TFCPS/DotNet/TFCPS_CodeUnitSpecific_DotNet.py,sha256=khRCEN6vvMo-eYoAC-y6qVPAmPSwNQezyu_oJnyLyho,37097
49
49
  ScriptCollection/TFCPS/DotNet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  ScriptCollection/TFCPS/Flutter/TFCPS_CodeUnitSpecific_Flutter.py,sha256=KAjyFyEjpkghsVPskfsHD68k4Z92gRCT_q6BXfikRwE,7660
51
51
  ScriptCollection/TFCPS/Flutter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -291,8 +291,8 @@ build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Python/TFCPS_Code
291
291
  build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
292
292
  build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Rust/TFCPS_CodeUnitSpecific_Rust.py,sha256=WhOsMpJxNGqnQGA3nJ99ruyqymxBeJxCcpK98zJduTo,1680
293
293
  build/lib/build/lib/build/lib/build/lib/ScriptCollection/TFCPS/Rust/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
294
- scriptcollection-4.2.85.dist-info/METADATA,sha256=lgooWAP8cXwyle75vQA30XvzjVIMZEI-nGLh_WQbcmQ,7696
295
- scriptcollection-4.2.85.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
296
- scriptcollection-4.2.85.dist-info/entry_points.txt,sha256=27XwAJEcaMEc1be0Ec1vKHCbiU4Ziu8jKL-SqsrYOIQ,4680
297
- scriptcollection-4.2.85.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
298
- scriptcollection-4.2.85.dist-info/RECORD,,
294
+ scriptcollection-4.2.86.dist-info/METADATA,sha256=s6PBYyXxJsNUfzOXK_1gJYHmRwb72BunRjBBEOw0OkE,7696
295
+ scriptcollection-4.2.86.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
296
+ scriptcollection-4.2.86.dist-info/entry_points.txt,sha256=27XwAJEcaMEc1be0Ec1vKHCbiU4Ziu8jKL-SqsrYOIQ,4680
297
+ scriptcollection-4.2.86.dist-info/top_level.txt,sha256=hY2hOVH0V0Ce51WB76zKkIWTUNwMUdHo4XDkR2vYVwg,17
298
+ scriptcollection-4.2.86.dist-info/RECORD,,