orionis 0.414.0__py3-none-any.whl → 0.415.0__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.
Files changed (79) hide show
  1. orionis/metadata/framework.py +1 -1
  2. orionis/test/core/unit_test.py +26 -10
  3. orionis/test/output/dumper.py +1 -1
  4. {orionis-0.414.0.dist-info → orionis-0.415.0.dist-info}/METADATA +1 -1
  5. {orionis-0.414.0.dist-info → orionis-0.415.0.dist-info}/RECORD +77 -68
  6. orionis-0.415.0.dist-info/top_level.txt +4 -0
  7. tests/container/entities/test_binding.py +1 -1
  8. tests/container/test_thread_safety.py +0 -1
  9. tests/testing/cases/__init__.py +0 -0
  10. tests/testing/cases/test_testing_asynchronous.py +63 -0
  11. tests/testing/cases/test_testing_synchronous.py +59 -0
  12. tests/testing/entities/__init__.py +0 -0
  13. tests/testing/entities/test_testing_result.py +185 -0
  14. tests/testing/enums/__init__.py +0 -0
  15. tests/testing/enums/test_testing_status.py +68 -0
  16. tests/testing/output/__init__.py +0 -0
  17. tests/testing/output/test_testing_dumper.py +32 -0
  18. tests/testing/output/test_testing_printer.py +42 -0
  19. tests/testing/test_testing_unit.py +110 -209
  20. orionis-0.414.0.dist-info/top_level.txt +0 -2
  21. tests/testing/test_testing_result.py +0 -131
  22. {tests/foundation → environment}/__init__.py +0 -0
  23. {tests/services/environment → environment}/test_services_environment.py +0 -0
  24. {tests/foundation/config → foundation}/__init__.py +0 -0
  25. {tests/foundation/config/app → foundation/config}/__init__.py +0 -0
  26. {tests/foundation/config/auth → foundation/config/app}/__init__.py +0 -0
  27. {tests/foundation → foundation}/config/app/test_foundation_config_app.py +0 -0
  28. {tests/foundation/config/cache → foundation/config/auth}/__init__.py +0 -0
  29. {tests/foundation → foundation}/config/auth/test_foundation_config_auth.py +0 -0
  30. {tests/foundation/config/cors → foundation/config/cache}/__init__.py +0 -0
  31. {tests/foundation → foundation}/config/cache/test_foundation_config_cache.py +0 -0
  32. {tests/foundation → foundation}/config/cache/test_foundation_config_cache_file.py +0 -0
  33. {tests/foundation → foundation}/config/cache/test_foundation_config_cache_stores.py +0 -0
  34. {tests/foundation/config/database → foundation/config/cors}/__init__.py +0 -0
  35. {tests/foundation → foundation}/config/cors/test_foundation_config_cors.py +0 -0
  36. {tests/foundation/config/filesystems → foundation/config/database}/__init__.py +0 -0
  37. {tests/foundation → foundation}/config/database/test_foundation_config_database.py +0 -0
  38. {tests/foundation → foundation}/config/database/test_foundation_config_database_connections.py +0 -0
  39. {tests/foundation → foundation}/config/database/test_foundation_config_database_mysql.py +0 -0
  40. {tests/foundation → foundation}/config/database/test_foundation_config_database_oracle.py +0 -0
  41. {tests/foundation → foundation}/config/database/test_foundation_config_database_pgsql.py +0 -0
  42. {tests/foundation → foundation}/config/database/test_foundation_config_database_sqlite.py +0 -0
  43. {tests/foundation/config/logging → foundation/config/filesystems}/__init__.py +0 -0
  44. {tests/foundation → foundation}/config/filesystems/test_foundation_config_filesystems.py +0 -0
  45. {tests/foundation → foundation}/config/filesystems/test_foundation_config_filesystems_aws.py +0 -0
  46. {tests/foundation → foundation}/config/filesystems/test_foundation_config_filesystems_disks.py +0 -0
  47. {tests/foundation → foundation}/config/filesystems/test_foundation_config_filesystems_local.py +0 -0
  48. {tests/foundation → foundation}/config/filesystems/test_foundation_config_filesystems_public.py +0 -0
  49. {tests/foundation/config/mail → foundation/config/logging}/__init__.py +0 -0
  50. {tests/foundation → foundation}/config/logging/test_foundation_config_logging.py +0 -0
  51. {tests/foundation → foundation}/config/logging/test_foundation_config_logging_channels.py +0 -0
  52. {tests/foundation → foundation}/config/logging/test_foundation_config_logging_chunked.py +0 -0
  53. {tests/foundation → foundation}/config/logging/test_foundation_config_logging_daily.py +0 -0
  54. {tests/foundation → foundation}/config/logging/test_foundation_config_logging_hourly.py +0 -0
  55. {tests/foundation → foundation}/config/logging/test_foundation_config_logging_monthly.py +0 -0
  56. {tests/foundation → foundation}/config/logging/test_foundation_config_logging_stack.py +0 -0
  57. {tests/foundation → foundation}/config/logging/test_foundation_config_logging_weekly.py +0 -0
  58. {tests/foundation/config/queue → foundation/config/mail}/__init__.py +0 -0
  59. {tests/foundation → foundation}/config/mail/test_foundation_config_mail.py +0 -0
  60. {tests/foundation → foundation}/config/mail/test_foundation_config_mail_file.py +0 -0
  61. {tests/foundation → foundation}/config/mail/test_foundation_config_mail_mailers.py +0 -0
  62. {tests/foundation → foundation}/config/mail/test_foundation_config_mail_smtp.py +0 -0
  63. {tests/foundation/config/root → foundation/config/queue}/__init__.py +0 -0
  64. {tests/foundation → foundation}/config/queue/test_foundation_config_queue.py +0 -0
  65. {tests/foundation → foundation}/config/queue/test_foundation_config_queue_brokers.py +0 -0
  66. {tests/foundation → foundation}/config/queue/test_foundation_config_queue_database.py +0 -0
  67. {tests/foundation/config/session → foundation/config/root}/__init__.py +0 -0
  68. {tests/foundation → foundation}/config/root/test_foundation_config_root_paths.py +0 -0
  69. {tests/foundation/config/startup → foundation/config/session}/__init__.py +0 -0
  70. {tests/foundation → foundation}/config/session/test_foundation_config_session.py +0 -0
  71. {tests/foundation/config/testing → foundation/config/startup}/__init__.py +0 -0
  72. {tests/foundation → foundation}/config/startup/test_foundation_config_startup.py +0 -0
  73. {tests/foundation/exceptions → foundation/config/testing}/__init__.py +0 -0
  74. {tests/foundation → foundation}/config/testing/test_foundation_config_testing.py +0 -0
  75. {tests/services/environment → foundation/exceptions}/__init__.py +0 -0
  76. {tests/foundation → foundation}/exceptions/test_foundation_config_exceptions.py +0 -0
  77. {orionis-0.414.0.dist-info → orionis-0.415.0.dist-info}/WHEEL +0 -0
  78. {orionis-0.414.0.dist-info → orionis-0.415.0.dist-info}/licenses/LICENCE +0 -0
  79. {orionis-0.414.0.dist-info → orionis-0.415.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,68 @@
1
+ from enum import Enum
2
+ from orionis.test.cases.asynchronous import AsyncTestCase
3
+ from orionis.test.enums.status import TestStatus
4
+
5
+ class TestTestStatus(AsyncTestCase):
6
+
7
+ async def testHasEnumMembers(self):
8
+ """
9
+ Checks that the TestStatus enum contains the expected members.
10
+
11
+ This test verifies the presence of the following enum members:
12
+ 'PASSED', 'FAILED', 'ERRORED', and 'SKIPPED'.
13
+
14
+ Returns
15
+ -------
16
+ None
17
+ This method does not return a value. It asserts the existence of enum members.
18
+ """
19
+ # Assert that each expected member exists in TestStatus
20
+ self.assertTrue(hasattr(TestStatus, "PASSED"))
21
+ self.assertTrue(hasattr(TestStatus, "FAILED"))
22
+ self.assertTrue(hasattr(TestStatus, "ERRORED"))
23
+ self.assertTrue(hasattr(TestStatus, "SKIPPED"))
24
+
25
+ async def testEnumValuesAreUnique(self):
26
+ """
27
+ Ensures that all TestStatus enum member values are unique.
28
+
29
+ This test collects all values from the TestStatus enum and checks for uniqueness.
30
+
31
+ Returns
32
+ -------
33
+ None
34
+ This method does not return a value. It asserts the uniqueness of enum values.
35
+ """
36
+ # Gather all enum values
37
+ values = [status.value for status in TestStatus]
38
+ # Assert that the number of values equals the number of unique values
39
+ self.assertEqual(len(values), len(set(values)))
40
+
41
+ async def testEnumIsInstanceOfEnum(self):
42
+ """
43
+ Validates that TestStatus is a subclass of Enum.
44
+
45
+ This test checks the inheritance of TestStatus from the Enum base class.
46
+
47
+ Returns
48
+ -------
49
+ None
50
+ This method does not return a value. It asserts the subclass relationship.
51
+ """
52
+ # Assert that TestStatus inherits from Enum
53
+ self.assertTrue(issubclass(TestStatus, Enum))
54
+
55
+ async def testEnumMembersType(self):
56
+ """
57
+ Confirms that each member of TestStatus is an instance of TestStatus.
58
+
59
+ This test iterates through all members of TestStatus and checks their type.
60
+
61
+ Returns
62
+ -------
63
+ None
64
+ This method does not return a value. It asserts the type of each enum member.
65
+ """
66
+ # Assert that each enum member is an instance of TestStatus
67
+ for status in TestStatus:
68
+ self.assertIsInstance(status, TestStatus)
File without changes
@@ -0,0 +1,32 @@
1
+ from orionis.test.cases.asynchronous import AsyncTestCase
2
+ from orionis.test.output.dumper import TestDumper
3
+
4
+ class TestTestingDumper(AsyncTestCase):
5
+
6
+ async def testMethodsExist(self):
7
+ """
8
+ Checks if the required methods are present in the TestDumper class.
9
+
10
+ This test verifies that the `TestDumper` class contains all methods
11
+ specified in the `required_methods` list. It asserts the existence of
12
+ each method using `hasattr`.
13
+
14
+ Returns
15
+ -------
16
+ None
17
+ This method does not return any value. It raises an assertion error if any required method is missing.
18
+ """
19
+
20
+ required_methods = [
21
+ "dd",
22
+ "dump"
23
+ ]
24
+
25
+ # Iterate over the list of required method names
26
+ for method_name in required_methods:
27
+
28
+ # Assert that each required method exists in TestDumper
29
+ self.assertTrue(
30
+ hasattr(TestDumper, method_name),
31
+ f"{method_name} does not exist"
32
+ )
@@ -0,0 +1,42 @@
1
+ from orionis.test.cases.asynchronous import AsyncTestCase
2
+ from orionis.test.output.printer import TestPrinter
3
+
4
+ class TestTestingPrinter(AsyncTestCase):
5
+
6
+ async def testMethodsExist(self):
7
+ """
8
+ Checks for the existence of required methods in the TestPrinter class.
9
+
10
+ This test ensures that all methods listed in `required_methods` are present
11
+ in the `TestPrinter` class by asserting their existence using `hasattr`.
12
+
13
+ Parameters
14
+ ----------
15
+ self : TestTestingPrinter
16
+ The test case instance.
17
+
18
+ Returns
19
+ -------
20
+ None
21
+ Raises an AssertionError if any required method is missing.
22
+ """
23
+ # List of method names that must exist in TestPrinter
24
+ required_methods = [
25
+ "print",
26
+ "startMessage",
27
+ "finishMessage",
28
+ "executePanel",
29
+ "linkWebReport",
30
+ "summaryTable",
31
+ "displayResults",
32
+ "unittestResult"
33
+ ]
34
+
35
+ # Check each required method for existence in TestPrinter
36
+ for method_name in required_methods:
37
+
38
+ # Assert that the method exists in TestPrinter
39
+ self.assertTrue(
40
+ hasattr(TestPrinter, method_name),
41
+ f"{method_name} does not exist"
42
+ )
@@ -1,209 +1,110 @@
1
- # from unittest import TestLoader
2
- # from unittest.mock import MagicMock, patch
3
- # from orionis.test.cases.asynchronous import AsyncTestCase
4
- # from orionis.test.core.unit_test import UnitTest
5
- # from orionis.test.enums import ExecutionMode
6
- # from unittest import (
7
- # TestSuite as StandardTestSuite,
8
- # TestResult as StandardTestResult
9
- # )
10
-
11
- # class TestTestingUnit(AsyncTestCase):
12
-
13
- # async def testDefaultConfiguration(self) -> None:
14
- # """
15
- # Test that UnitTest initializes with correct default configuration values.
16
-
17
- # Notes
18
- # -----
19
- # Verifies that all default attributes are set as expected upon initialization.
20
- # """
21
- # unit_test = UnitTest()
22
- # self.assertIsInstance(unit_test.loader, TestLoader)
23
- # self.assertIsInstance(unit_test.suite, StandardTestSuite)
24
-
25
- # async def testConfigureMethod(self) -> None:
26
- # """
27
- # Test the `configure` method for correct configuration updates.
28
- # This test verifies that all configuration parameters of the `UnitTest` class
29
- # can be updated through the `configure` method and that the changes are
30
- # reflected in the instance attributes.
31
-
32
- # Parameters
33
- # ----------
34
- # self : TestCase
35
- # The test case instance.
36
-
37
- # Notes
38
- # -----
39
- # The test checks the following configuration parameters:
40
- # - verbosity
41
- # - execution_mode
42
- # - max_workers
43
- # - fail_fast
44
- # - print_result
45
- # - throw_exception
46
- # It also asserts that the `configure` method returns the instance itself.
47
- # """
48
- # unit_test = UnitTest()
49
- # configured = unit_test.configure(
50
- # verbosity=1,
51
- # execution_mode=ExecutionMode.PARALLEL,
52
- # max_workers=8,
53
- # fail_fast=True,
54
- # print_result=False,
55
- # throw_exception=True
56
- # )
57
-
58
- # self.assertEqual(unit_test.verbosity, 1)
59
- # self.assertEqual(unit_test.execution_mode, ExecutionMode.PARALLEL.value)
60
- # self.assertEqual(unit_test.max_workers, 8)
61
- # self.assertTrue(unit_test.fail_fast)
62
- # self.assertFalse(unit_test.print_result)
63
- # self.assertTrue(unit_test.throw_exception)
64
- # self.assertEqual(configured, unit_test)
65
-
66
- # async def testDiscoverTestsInModule(self) -> None:
67
- # """
68
- # Test that `discoverTestsInModule` correctly loads tests from a module.
69
-
70
- # Verifies that tests can be discovered from a module and added to the test suite.
71
-
72
- # Notes
73
- # -----
74
- # This test mocks the loader's `loadTestsFromName` method to ensure that
75
- # `discoverTestsInModule` calls it with the correct arguments and that the
76
- # returned suite is handled as expected.
77
- # """
78
- # unit_test = UnitTest()
79
- # with patch.object(unit_test.loader, 'loadTestsFromName') as mock_load:
80
- # mock_load.return_value = StandardTestSuite()
81
- # result = unit_test.discoverTestsInModule(module_name='test_module')
82
-
83
- # mock_load.assert_called_once_with(name='test_module')
84
- # self.assertEqual(result, unit_test)
85
- # self.assertEqual(len(unit_test.suite._tests), 0)
86
-
87
- # async def testFlattenTestSuite(self) -> None:
88
- # """
89
- # Test the _flattenTestSuite method for correct flattening of nested test suites.
90
- # This test verifies that the _flattenTestSuite method of the UnitTest class
91
- # correctly flattens both simple and nested unittest suites into a single list
92
- # of test cases.
93
-
94
- # Parameters
95
- # ----------
96
- # self : TestCase
97
- # The test case instance.
98
-
99
- # Notes
100
- # -----
101
- # - Ensures that nested suites are recursively flattened.
102
- # - Asserts that all test cases from nested suites are present in the flattened result.
103
- # """
104
- # unit_test = UnitTest()
105
- # test_case1 = MagicMock()
106
- # test_case2 = MagicMock()
107
-
108
- # nested_suite = StandardTestSuite()
109
- # nested_suite.addTest(test_case1)
110
- # nested_suite.addTest(test_case2)
111
-
112
- # main_suite = StandardTestSuite()
113
- # main_suite.addTest(nested_suite)
114
-
115
- # flattened = unit_test._UnitTest__flattenTestSuite(main_suite)
116
- # self.assertEqual(len(flattened), 2)
117
- # self.assertIn(test_case1, flattened)
118
- # self.assertIn(test_case2, flattened)
119
-
120
- # async def testMergeTestResults(self) -> None:
121
- # """
122
- # Test the _mergeTestResults method for correct merging of test results.
123
- # Ensures that the method accurately combines the number of tests run,
124
- # as well as the lists of failures and errors from individual test results.
125
-
126
- # Notes
127
- # -----
128
- # - Verifies that the total number of tests run is updated correctly.
129
- # - Checks that failures and errors are merged without loss of information.
130
- # """
131
- # unit_test = UnitTest()
132
- # combined = StandardTestResult()
133
- # individual = StandardTestResult()
134
-
135
- # individual.testsRun = 2
136
- # individual.failures = [('test1', 'failure')]
137
- # individual.errors = [('test2', 'error')]
138
-
139
- # unit_test._UnitTest__mergeTestResults(combined, individual)
140
- # self.assertEqual(combined.testsRun, 2)
141
- # self.assertEqual(len(combined.failures), 1)
142
- # self.assertEqual(len(combined.errors), 1)
143
-
144
- # async def testClearTests(self) -> None:
145
- # """
146
- # Test the clearTests method to ensure it resets the test suite.
147
- # This test verifies that after adding a mock test to the suite and calling
148
- # the clearTests method, the suite is emptied as expected.
149
-
150
- # Steps
151
- # -----
152
- # 1. Create an instance of UnitTest.
153
- # 2. Add a mock test to the test suite.
154
- # 3. Call the clearTests method.
155
- # 4. Assert that the test suite is empty.
156
-
157
- # Assertions
158
- # ----------
159
- # - The length of the test suite should be zero after calling clearTests.
160
- # """
161
- # unit_test = UnitTest()
162
- # mock_test = MagicMock()
163
- # unit_test.suite.addTest(mock_test)
164
-
165
- # unit_test.clearTests()
166
- # self.assertEqual(len(unit_test.suite._tests), 0)
167
-
168
- # async def testGetTestNames(self) -> None:
169
- # """
170
- # This test verifies that the `getTestNames` method of the `UnitTest` class
171
- # correctly extracts and returns the identifiers of tests present in the test suite.
172
-
173
- # Notes
174
- # -----
175
- # - Mocks a test case with a predefined identifier.
176
- # - Adds the mock test to the test suite.
177
- # - Asserts that the returned list of test names matches the expected value.
178
- # """
179
- # unit_test = UnitTest()
180
- # mock_test = MagicMock()
181
- # mock_test.id.return_value = 'test_id'
182
- # unit_test.suite.addTest(mock_test)
183
-
184
- # names = unit_test.getTestNames()
185
- # self.assertEqual(names, ['test_id'])
186
-
187
- # async def testGetTestCount(self) -> None:
188
- # """
189
- # Test that `getTestCount` returns the correct number of tests.
190
-
191
- # Verifies that the count matches the number of tests in the suite.
192
-
193
- # Notes
194
- # -----
195
- # - Adds two mock tests to the suite.
196
- # - Asserts that `getTestCount` returns 2.
197
-
198
- # Returns
199
- # -------
200
- # None
201
- # """
202
- # unit_test = UnitTest()
203
- # mock_test1 = MagicMock()
204
- # mock_test2 = MagicMock()
205
- # unit_test.suite.addTest(mock_test1)
206
- # unit_test.suite.addTest(mock_test2)
207
-
208
- # count = unit_test.getTestCount()
209
- # self.assertEqual(count, 2)
1
+ import unittest
2
+ from unittest.mock import MagicMock
3
+ from orionis.foundation.config.testing.enums.drivers import PersistentDrivers
4
+ from orionis.foundation.config.testing.enums.mode import ExecutionMode
5
+ from orionis.test.cases.asynchronous import AsyncTestCase
6
+ from orionis.test.core.unit_test import UnitTest
7
+
8
+ class TestTestingUnit(AsyncTestCase):
9
+
10
+ async def testDefaultConfiguration(self) -> None:
11
+ """
12
+ Test that the `UnitTest` class initializes with correct default configuration values.
13
+ """
14
+ unit_test = UnitTest()
15
+ self.assertIsInstance(unit_test._UnitTest__loader, unittest.TestLoader)
16
+ self.assertIsInstance(unit_test._UnitTest__suite, unittest.TestSuite)
17
+
18
+ async def testConfigureMethod(self) -> None:
19
+ """
20
+ Tests the `configure` method of the `UnitTest` class for correct configuration updates.
21
+ """
22
+ unit_test = UnitTest()
23
+ configured = unit_test.configure(
24
+ verbosity=1,
25
+ execution_mode=ExecutionMode.PARALLEL,
26
+ max_workers=8,
27
+ fail_fast=True,
28
+ print_result=False,
29
+ throw_exception=True,
30
+ persistent=False,
31
+ persistent_driver=PersistentDrivers.JSON,
32
+ web_report=False
33
+ )
34
+ self.assertEqual(unit_test._UnitTest__verbosity, 1)
35
+ self.assertEqual(unit_test._UnitTest__execution_mode, ExecutionMode.PARALLEL.value)
36
+ self.assertEqual(unit_test._UnitTest__max_workers, 8)
37
+ self.assertTrue(unit_test._UnitTest__fail_fast)
38
+ self.assertTrue(unit_test._UnitTest__throw_exception)
39
+ self.assertFalse(unit_test._UnitTest__persistent)
40
+ self.assertEqual(unit_test._UnitTest__persistent_driver, PersistentDrivers.JSON.value)
41
+ self.assertFalse(unit_test._UnitTest__web_report)
42
+ self.assertIs(configured, unit_test)
43
+
44
+ async def testFlattenTestSuite(self) -> None:
45
+ """
46
+ Tests the `_flattenTestSuite` method of the `UnitTest` class for correct flattening of nested test suites.
47
+ """
48
+ unit_test = UnitTest()
49
+ test_case1 = MagicMock()
50
+ test_case2 = MagicMock()
51
+ nested_suite = unittest.TestSuite()
52
+ nested_suite.addTest(test_case1)
53
+ nested_suite.addTest(test_case2)
54
+ main_suite = unittest.TestSuite()
55
+ main_suite.addTest(nested_suite)
56
+ flattened = unit_test._UnitTest__flattenTestSuite(main_suite)
57
+ self.assertEqual(len(flattened), 2)
58
+ self.assertIn(test_case1, flattened)
59
+ self.assertIn(test_case2, flattened)
60
+
61
+ async def testMergeTestResults(self) -> None:
62
+ """
63
+ Tests the `_mergeTestResults` method of the `UnitTest` class for correct aggregation of test results.
64
+ """
65
+ unit_test = UnitTest()
66
+ combined = unittest.TestResult()
67
+ individual = unittest.TestResult()
68
+ individual.testsRun = 2
69
+ individual.failures = [('test1', 'failure')]
70
+ individual.errors = [('test2', 'error')]
71
+ individual.skipped = []
72
+ individual.expectedFailures = []
73
+ individual.unexpectedSuccesses = []
74
+ unit_test._UnitTest__mergeTestResults(combined, individual)
75
+ self.assertEqual(combined.testsRun, 2)
76
+ self.assertEqual(len(combined.failures), 1)
77
+ self.assertEqual(len(combined.errors), 1)
78
+
79
+ async def testClearTests(self) -> None:
80
+ """
81
+ Tests the `clearTests` method of the `UnitTest` class to ensure it properly resets the test suite.
82
+ """
83
+ unit_test = UnitTest()
84
+ mock_test = MagicMock()
85
+ unit_test._UnitTest__suite.addTest(mock_test)
86
+ unit_test.clearTests()
87
+ self.assertEqual(len(unit_test._UnitTest__suite._tests), 0)
88
+
89
+ async def testGetTestNames(self) -> None:
90
+ """
91
+ Tests the `getTestNames` method of the `UnitTest` class for correct extraction of test identifiers.
92
+ """
93
+ unit_test = UnitTest()
94
+ mock_test = MagicMock()
95
+ mock_test.id.return_value = 'test_id'
96
+ unit_test._UnitTest__suite.addTest(mock_test)
97
+ names = unit_test.getTestNames()
98
+ self.assertEqual(names, ['test_id'])
99
+
100
+ async def testGetTestCount(self) -> None:
101
+ """
102
+ Tests the `getTestCount` method of the `UnitTest` class for accurate test counting.
103
+ """
104
+ unit_test = UnitTest()
105
+ mock_test1 = MagicMock()
106
+ mock_test2 = MagicMock()
107
+ unit_test._UnitTest__suite.addTest(mock_test1)
108
+ unit_test._UnitTest__suite.addTest(mock_test2)
109
+ count = unit_test.getTestCount()
110
+ self.assertEqual(count, 2)
@@ -1,2 +0,0 @@
1
- orionis
2
- tests
@@ -1,131 +0,0 @@
1
- # from orionis.test.cases.asynchronous import AsyncTestCase
2
- # from orionis.test.entities.result import TestResult
3
- # from orionis.test.enums import TestStatus
4
-
5
- # class TestTestingResult(AsyncTestCase):
6
-
7
- # async def testDefaultValues(self) -> None:
8
- # """
9
- # Ensures that when optional fields are not provided during initialization of a TestResult
10
- # instance, they are set to None.
11
-
12
- # Notes
13
- # -----
14
- # This test verifies the default behavior of the following optional fields:
15
- # - error_message
16
- # - traceback
17
- # - class_name
18
- # - method
19
- # - module
20
- # - file_path
21
-
22
- # Assertions
23
- # ----------
24
- # Each optional field is checked to confirm it is None after initialization.
25
- # """
26
- # result = TestResult(
27
- # id=1,
28
- # name="Sample Test",
29
- # status=TestStatus.PASSED,
30
- # execution_time=0.5
31
- # )
32
- # self.assertIsNone(result.error_message)
33
- # self.assertIsNone(result.traceback)
34
- # self.assertIsNone(result.class_name)
35
- # self.assertIsNone(result.method)
36
- # self.assertIsNone(result.module)
37
- # self.assertIsNone(result.file_path)
38
-
39
- # async def testRequiredFields(self) -> None:
40
- # """
41
- # Test that TestResult enforces the presence of all required (non-optional) fields during initialization.
42
- # This test verifies that omitting any required field when creating a TestResult instance raises a TypeError.
43
-
44
- # Notes
45
- # -----
46
- # - Attempts to instantiate TestResult with no arguments.
47
- # - Attempts to instantiate TestResult missing the 'id' field.
48
- # - Expects a TypeError to be raised in both cases.
49
- # """
50
- # with self.assertRaises(TypeError):
51
- # TestResult() # Missing all required fields
52
-
53
- # with self.assertRaises(TypeError):
54
- # # Missing id
55
- # TestResult(
56
- # name="Sample Test",
57
- # status=TestStatus.PASSED,
58
- # execution_time=0.5
59
- # )
60
-
61
- # async def testImmutable(self) -> None:
62
- # """
63
- # Test the immutability of TestResult instances.
64
- # This test ensures that TestResult, implemented as a frozen dataclass, does not allow
65
- # modification of its attributes after instantiation.
66
-
67
- # Parameters
68
- # ----------
69
- # self : TestCase
70
- # The test case instance.
71
-
72
- # Raises
73
- # ------
74
- # FrozenInstanceError
75
- # If an attempt is made to modify an attribute of a frozen TestResult instance.
76
- # """
77
- # result = TestResult(
78
- # id=1,
79
- # name="Sample Test",
80
- # status=TestStatus.PASSED,
81
- # execution_time=0.5
82
- # )
83
- # with self.assertRaises(Exception):
84
- # result.name = "Modified Name"
85
-
86
- # async def testStatusValues(self) -> None:
87
- # """
88
- # Parameters
89
- # ----------
90
- # self : TestCase
91
- # The test case instance.
92
-
93
- # Notes
94
- # -----
95
- # This test iterates over all possible values of the `TestStatus` enum and verifies
96
- # that each value can be assigned to the `status` field of a `TestResult` instance.
97
- # It asserts that the assigned status matches the expected value.
98
- # """
99
- # for status in TestStatus:
100
- # result = TestResult(
101
- # id=1,
102
- # name="Status Test",
103
- # status=status,
104
- # execution_time=0.1
105
- # )
106
- # self.assertEqual(result.status, status)
107
-
108
- # async def testErrorFields(self) -> None:
109
- # """
110
- # Parameters
111
- # ----------
112
- # self : TestCase
113
- # The test case instance.
114
-
115
- # Notes
116
- # -----
117
- # Verifies that the `error_message` and `traceback` fields are correctly stored in the `TestResult`
118
- # object when provided during initialization.
119
- # """
120
- # error_msg = "Test failed"
121
- # traceback = "Traceback info"
122
- # result = TestResult(
123
- # id=1,
124
- # name="Failing Test",
125
- # status=TestStatus.FAILED,
126
- # execution_time=0.2,
127
- # error_message=error_msg,
128
- # traceback=traceback
129
- # )
130
- # self.assertEqual(result.error_message, error_msg)
131
- # self.assertEqual(result.traceback, traceback)
File without changes
File without changes