Added Python 3.12 support.

Merge junit files.
Merge coverage files.
Extending UnitTesting to support code coverage in a matrix too.
This commit is contained in:
Patrick Lehmann
2023-10-08 17:33:34 +02:00
parent 582c5620b7
commit ec038f96e8
24 changed files with 944 additions and 339 deletions

View File

@@ -28,12 +28,12 @@
# SPDX-License-Identifier: Apache-2.0 #
# ==================================================================================================================== #
#
"""Unit tests for TBD."""
from os import getenv as os_getenv
from pytest import mark
from unittest import TestCase
from unittest import TestCase
from pyTooling.Platform import Platform
from pytest import mark
from pyTooling.Common import CurrentPlatform
from pyDummy import Application
if __name__ == "__main__": # pragma: no cover
@@ -42,75 +42,57 @@ if __name__ == "__main__": # pragma: no cover
exit(1)
class AnyPlatform(TestCase):
expected = os_getenv("ENVIRONMENT_NAME", default="Windows (x86-64)")
class PlatformTesting(TestCase):
@mark.skipif(not CurrentPlatform.IsNativeLinux, reason="Skipped, if current platform isn't native Linux.")
def test_ApplicationOnNativeLinux(self):
app = Application()
@mark.skipif(os_getenv("ENVIRONMENT_NAME", "skip") == "skip", reason="Skipped when environment variable 'ENVIRONMENT_NAME' isn't set.")
def test_PlatformString(self) -> None:
platform = Platform()
self.assertEqual(1, app.Value)
print()
print(platform)
@mark.skipif(not CurrentPlatform.IsNativeMacOS, reason="Skipped, if current platform isn't native macOS.")
def test_ApplicationOnNativeMacOS(self):
app = Application()
@mark.skipif("Linux (x86-64)" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_NativeLinux' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_NativeLinux(self) -> None:
platform = Platform()
self.assertEqual(2, app.Value)
print()
print(platform)
@mark.skipif(not CurrentPlatform.IsNativeWindows, reason="Skipped, if current platform isn't native Windows.")
def test_ApplicationOnNativeWindows(self):
app = Application()
@mark.skipif("MacOS (x86-64)" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_NativeMacOS' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_NativeMacOS(self) -> None:
platform = Platform()
self.assertEqual(3, app.Value)
print()
print(platform)
@mark.skipif(not CurrentPlatform.IsMSYSOnWindows, reason="Skipped, if current platform isn't MSYS on Windows.")
def test_ApplicationOnMSYS2OnWindows(self):
app = Application()
@mark.skipif("Windows (x86-64)" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_NativeWindows' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_NativeWindows(self) -> None:
platform = Platform()
self.assertEqual(11, app.Value)
print()
print(platform)
@mark.skipif(not CurrentPlatform.IsMinGW32OnWindows, reason="Skipped, if current platform isn't MinGW32 on Windows.")
def test_ApplicationOnMinGW32OnWindows(self):
app = Application()
@mark.skipif("Windows+MSYS2 (x86-64) - MSYS" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_MSYS' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_MSYS(self) -> None:
platform = Platform()
self.assertEqual(12, app.Value)
print()
print(platform)
@mark.skipif(not CurrentPlatform.IsMinGW64OnWindows, reason="Skipped, if current platform isn't MinGW64 on Windows.")
def test_ApplicationOnMinGW64OnWindows(self):
app = Application()
@mark.skipif("Windows+MSYS2 (x86-64) - MinGW32" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_MinGW32' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_MinGW32(self) -> None:
platform = Platform()
self.assertEqual(13, app.Value)
print()
print(platform)
@mark.skipif(not CurrentPlatform.IsUCRT64OnWindows, reason="Skipped, if current platform isn't UCRT64 on Windows.")
def test_ApplicationOnURTC64OnWindows(self):
app = Application()
@mark.skipif("Windows+MSYS2 (x86-64) - MinGW64" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_MinGW64' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_MinGW64(self) -> None:
platform = Platform()
self.assertEqual(14, app.Value)
print()
print(platform)
@mark.skipif(not CurrentPlatform.IsClang32OnWindows, reason="Skipped, if current platform isn't Clang32 on Windows.")
def test_ApplicationOnClang32OnWindows(self):
app = Application()
@mark.skipif("Windows+MSYS2 (x86-64) - UCRT64" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_UCRT64' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_UCRT64(self) -> None:
platform = Platform()
self.assertEqual(15, app.Value)
print()
print(platform)
@mark.skipif(not CurrentPlatform.IsClang64OnWindows, reason="Skipped, if current platform isn't Clang64 on Windows.")
def test_ApplicationOnClang64OnWindows(self):
app = Application()
@mark.skipif("Windows+MSYS2 (x86-64) - Clang32" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_Clang32' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_Clang32(self) -> None:
platform = Platform()
print()
print(platform)
@mark.skipif("Windows+MSYS2 (x86-64) - Clang64" != os_getenv("ENVIRONMENT_NAME", "skip"), reason=f"Skipped 'test_Clang64' when environment variable 'ENVIRONMENT_NAME' doesn't match. {os_getenv('ENVIRONMENT_NAME', 'skip')}")
def test_Clang64(self) -> None:
platform = Platform()
print()
print(platform)
self.assertEqual(16, app.Value)

View File

@@ -37,4 +37,4 @@ class Instantiation(TestCase):
def test_Application(self):
app = Application()
self.assertEqual(1, app.Value)
self.assertGreater(app.Value, 0)

View File

@@ -28,4 +28,4 @@
# SPDX-License-Identifier: Apache-2.0 #
# ==================================================================================================================== #
#
"""Test code for pyTooling."""
"""Test code for pyDummy."""