orionis 0.282.0__py3-none-any.whl → 0.284.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 (48) hide show
  1. orionis/application.py +2 -7
  2. orionis/foundation/config/testing/entities/testing.py +25 -0
  3. orionis/metadata/framework.py +1 -1
  4. orionis/services/asynchrony/{async_io.py → coroutines.py} +2 -1
  5. orionis/services/asynchrony/exceptions/__init__.py +0 -0
  6. orionis/services/asynchrony/exceptions/coroutine_exception.py +26 -0
  7. orionis/services/environment/dot_env.py +44 -14
  8. orionis/services/environment/env.py +60 -12
  9. orionis/services/environment/exceptions/__init__.py +0 -0
  10. orionis/services/environment/exceptions/value_exception.py +27 -0
  11. orionis/services/introspection/exceptions/__init__.py +0 -0
  12. orionis/services/introspection/exceptions/types.py +0 -0
  13. orionis/services/introspection/helpers/__init__.py +0 -0
  14. orionis/services/introspection/helpers/functions.py +285 -0
  15. orionis/services/introspection/reflection.py +216 -0
  16. orionis/services/parsers/exceptions/__init__.py +0 -0
  17. orionis/services/parsers/serializer.py +1 -1
  18. orionis/services/paths/exceptions/__init__.py +0 -0
  19. orionis/services/paths/exceptions/not_found_exceptions.py +28 -0
  20. orionis/services/paths/exceptions/path_value_exceptions.py +28 -0
  21. orionis/services/paths/resolver.py +6 -4
  22. orionis/services/standard/exceptions/__init__.py +0 -0
  23. orionis/services/standard/exceptions/path_value_exceptions.py +28 -0
  24. orionis/services/standard/std.py +4 -3
  25. orionis/test/entities/test_result.py +14 -1
  26. orionis/test/exceptions/test_persistence_error.py +34 -0
  27. orionis/test/exceptions/test_runtime_error.py +26 -0
  28. orionis/test/exceptions/test_value_error.py +26 -0
  29. orionis/test/logs/contracts/__init__.py +0 -0
  30. orionis/test/logs/contracts/history.py +54 -0
  31. orionis/test/logs/history.py +372 -0
  32. orionis/test/output/contracts/dumper.py +24 -8
  33. orionis/test/output/dumper.py +52 -21
  34. orionis/test/suites/contracts/test_suite.py +27 -13
  35. orionis/test/suites/contracts/test_unit.py +101 -61
  36. orionis/test/suites/test_suite.py +57 -25
  37. orionis/test/suites/test_unit.py +559 -290
  38. orionis/unittesting.py +13 -1
  39. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/METADATA +1 -1
  40. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/RECORD +47 -27
  41. tests/services/asynchrony/test_async_io.py +3 -2
  42. tests/services/environment/test_env.py +3 -3
  43. orionis/test/logs/log_test.py +0 -211
  44. /orionis/services/parsers/{exception.py → exceptions/exception_parser.py} +0 -0
  45. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/WHEEL +0 -0
  46. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/licenses/LICENCE +0 -0
  47. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/top_level.txt +0 -0
  48. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,34 @@
1
+ class OrionisTestPersistenceError(Exception):
2
+ """
3
+ Custom exception for persistence errors in tests within the Orionis framework.
4
+
5
+ This exception is used to indicate issues related to data persistence during test execution,
6
+ providing a descriptive message to help identify and resolve the error.
7
+
8
+ Args:
9
+ msg (str): A descriptive message explaining the cause of the persistence error.
10
+
11
+ Example:
12
+ raise OrionisTestPersistenceError("Failed to save test state to the database.")
13
+ """
14
+
15
+ def __init__(self, msg: str):
16
+ """
17
+ Initializes the OrionisTestConfigException with a specific error message.
18
+
19
+ Args:
20
+ msg (str): A descriptive error message explaining the cause of the exception.
21
+ """
22
+ super().__init__(msg)
23
+
24
+ def __str__(self) -> str:
25
+ """
26
+ Returns a formatted string representation of the exception.
27
+
28
+ The string includes the exception name and the error message, providing
29
+ a clear and concise description of the issue.
30
+
31
+ Returns:
32
+ str: A formatted string describing the exception.
33
+ """
34
+ return f"{self.__class__.__name__}: {self.args[0]}"
@@ -0,0 +1,26 @@
1
+ class OrionisTestRuntimeError(Exception):
2
+ """
3
+ Exception raised for errors that occur during the runtime of Orionis tests.
4
+ This exception is intended to provide a clear and descriptive error message
5
+ when a runtime error is encountered in the Orionis testing framework.
6
+ Attributes:
7
+ Example:
8
+ raise OrionisTestRuntimeError("An unexpected runtime error occurred during testing.")
9
+ """
10
+
11
+ def __init__(self, msg: str):
12
+ """
13
+ Initializes the exception with a given error message.
14
+ Args:
15
+ msg (str): The error message describing the runtime error.
16
+ """
17
+ super().__init__(msg)
18
+
19
+ def __str__(self) -> str:
20
+ """
21
+ Return a string representation of the exception, including the class name and the first argument.
22
+
23
+ Returns:
24
+ str: A string in the format '<ClassName>: <first argument>'.
25
+ """
26
+ return f"{self.__class__.__name__}: {self.args[0]}"
@@ -0,0 +1,26 @@
1
+ class OrionisTestValueError(Exception):
2
+ """
3
+ Custom exception class for handling value errors in the Orionis test framework.
4
+ This exception should be raised when a value-related error occurs during testing.
5
+ It provides a formatted string representation that includes the class name and the error message.
6
+ Example:
7
+ raise OrionisTestValueError("Invalid value provided.")
8
+ """
9
+
10
+ def __init__(self, msg: str):
11
+ """
12
+ Initializes the exception with a custom error message.
13
+
14
+ Args:
15
+ msg (str): The error message describing the exception.
16
+ """
17
+ super().__init__(msg)
18
+
19
+ def __str__(self) -> str:
20
+ """
21
+ Return a string representation of the exception, including the class name and the first argument.
22
+
23
+ Returns:
24
+ str: A formatted string in the form 'ClassName: message'.
25
+ """
26
+ return f"{self.__class__.__name__}: {self.args[0]}"
File without changes
@@ -0,0 +1,54 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Dict, List, Optional, Tuple
3
+
4
+ class ITestHistory(ABC):
5
+
6
+ @abstractmethod
7
+ def create(self, report: Dict) -> bool:
8
+ """
9
+ Create a new test report in the history database.
10
+
11
+ Parameters
12
+ ----------
13
+ report : Dict
14
+ A dictionary containing the test report data.
15
+
16
+ Returns
17
+ -------
18
+ bool
19
+ True if the report was successfully created, False otherwise.
20
+ """
21
+ pass
22
+
23
+ def reset(self) -> bool:
24
+ """
25
+ Reset the history database by dropping the existing table.
26
+
27
+ Returns
28
+ -------
29
+ bool
30
+ True if the database was successfully reset, False otherwise.
31
+ """
32
+ pass
33
+
34
+ def get(
35
+ self,
36
+ first: Optional[int] = None,
37
+ last: Optional[int] = None
38
+ ) -> List[Tuple]:
39
+ """
40
+ Retrieve test reports from the history database.
41
+
42
+ Parameters
43
+ ----------
44
+ first : Optional[int], default=None
45
+ The number of earliest reports to retrieve, ordered ascending by ID.
46
+ last : Optional[int], default=None
47
+ The number of latest reports to retrieve, ordered descending by ID.
48
+
49
+ Returns
50
+ -------
51
+ List[Tuple]
52
+ A list of tuples representing the retrieved reports.
53
+ """
54
+ pass
@@ -0,0 +1,372 @@
1
+ import json
2
+ import re
3
+ import sqlite3
4
+ from pathlib import Path
5
+ from typing import Dict, List, Optional, Tuple
6
+ from orionis.services.environment.env import Env
7
+ from orionis.test.exceptions.test_persistence_error import OrionisTestPersistenceError
8
+ from orionis.test.exceptions.test_value_error import OrionisTestValueError
9
+ from orionis.test.logs.contracts.history import ITestHistory
10
+
11
+ class TestHistory(ITestHistory):
12
+
13
+ def __init__(
14
+ self,
15
+ storage_path: Optional[str] = None,
16
+ db_name: Optional[str] = 'tests.sqlite',
17
+ table_name: Optional[str] = 'reports',
18
+ ) -> None:
19
+ """
20
+ Initialize the history storage for test logs.
21
+
22
+ Parameters
23
+ ----------
24
+ storage_path : Optional[str], default=None
25
+ Directory path where the database file will be stored. If not provided,
26
+ the path is determined from the TEST_DB_PATH environment variable or
27
+ defaults to 'orionis/test/logs/storage' in the current working directory.
28
+ db_name : Optional[str], default='tests.sqlite'
29
+ Name of the SQLite database file. Must be alphanumeric or underscore and
30
+ end with '.sqlite'.
31
+ table_name : Optional[str], default='reports'
32
+ Name of the table to use in the database. Must be alphanumeric or underscore.
33
+
34
+ Raises
35
+ ------
36
+ OrionisTestValueError
37
+ If db_name or table_name do not meet the required format.
38
+ """
39
+
40
+ # Validate db_name: only alphanumeric and underscores, must end with .sqlite
41
+ if not isinstance(db_name, str) or not re.fullmatch(r'[a-zA-Z0-9_]+\.sqlite', db_name):
42
+ raise OrionisTestValueError("Database name must be alphanumeric/underscore and end with '.sqlite'.")
43
+ self.__db_name = db_name
44
+
45
+ # Validate table_name: only alphanumeric and underscores
46
+ if not isinstance(table_name, str) or not re.fullmatch(r'[a-zA-Z0-9_]+', table_name):
47
+ raise OrionisTestValueError("Table name must be alphanumeric/underscore only.")
48
+ self.__table_name = table_name
49
+
50
+ # Determine database path
51
+ db_path = None
52
+ if storage_path:
53
+ db_path = Path(storage_path).expanduser().resolve()
54
+ if db_path.is_dir():
55
+ db_path = db_path / self.__db_name
56
+ else:
57
+ env_path = Env.get(key="TEST_DB_PATH", default=None, is_path=True)
58
+ if env_path:
59
+ db_path = Path(env_path).expanduser().resolve()
60
+ if db_path.is_dir():
61
+ db_path = db_path / self.__db_name
62
+ else:
63
+ db_path = Path.cwd() / 'storage/framework/testing' / self.__db_name
64
+
65
+ # Ensure parent directory exists
66
+ db_path.parent.mkdir(parents=True, exist_ok=True)
67
+
68
+ # Store path in environment
69
+ Env.set(key="TEST_DB_PATH", value=str(db_path), is_path=True)
70
+ self.__db_path = db_path
71
+
72
+ # Create a connection to the database, initially set to None
73
+ self._conn: Optional[sqlite3.Connection] = None
74
+
75
+ def __connect(self) -> None:
76
+ """
77
+ Establishes a connection to the SQLite database if not already connected.
78
+
79
+ Attempts to create a new SQLite connection using the provided database path.
80
+ If the connection fails, raises an OrionisTestPersistenceError with the error details.
81
+
82
+ Raises
83
+ ------
84
+ OrionisTestPersistenceError
85
+ If a database connection error occurs.
86
+ """
87
+ if self._conn is None:
88
+ try:
89
+ self._conn = sqlite3.connect(str(self.__db_path))
90
+ except (sqlite3.Error, Exception) as e:
91
+ raise OrionisTestPersistenceError(f"Database connection error: {e}")
92
+ finally:
93
+ self._conn = None
94
+
95
+ def __createTableIfNotExists(self) -> bool:
96
+ """
97
+ Ensures that the test history table exists in the database.
98
+
99
+ Connects to the database and creates the table with the required schema if it does not already exist.
100
+ Handles any SQLite errors by rolling back the transaction and raising a custom exception.
101
+
102
+ Raises
103
+ ------
104
+ OrionisTestPersistenceError
105
+ If the table creation fails due to a database error.
106
+
107
+ Returns
108
+ -------
109
+ bool
110
+ True if the table was created successfully or already exists, False otherwise.
111
+ """
112
+
113
+ self.__connect()
114
+ try:
115
+ cursor = self._conn.cursor()
116
+ cursor.execute(f'''
117
+ CREATE TABLE IF NOT EXISTS {self.__table_name} (
118
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
119
+ json TEXT NOT NULL,
120
+ total_tests INTEGER,
121
+ passed INTEGER,
122
+ failed INTEGER,
123
+ errors INTEGER,
124
+ skipped INTEGER,
125
+ total_time REAL,
126
+ success_rate REAL,
127
+ timestamp TEXT
128
+ )
129
+ ''')
130
+ self._conn.commit()
131
+ return True
132
+ except sqlite3.Error as e:
133
+ if self._conn:
134
+ self._conn.rollback()
135
+ raise OrionisTestPersistenceError(f"Failed to create table: {e}")
136
+ finally:
137
+ if self._conn:
138
+ self.__close()
139
+ self._conn = None
140
+
141
+ def __insertReport(self, report: Dict) -> bool:
142
+ """
143
+ Inserts a test report into the history database table.
144
+
145
+ Parameters
146
+ ----------
147
+ report : Dict
148
+ A dictionary containing the report data. Must include the following keys:
149
+ - total_tests
150
+ - passed
151
+ - failed
152
+ - errors
153
+ - skipped
154
+ - total_time
155
+ - success_rate
156
+ - timestamp
157
+
158
+ Raises
159
+ ------
160
+ OrionisTestPersistenceError
161
+ If there is an error inserting the report into the database.
162
+ OrionisTestValueError
163
+ If required fields are missing from the report.
164
+
165
+ Returns
166
+ -------
167
+ bool
168
+ True if the report was successfully inserted, False otherwise.
169
+ """
170
+
171
+ # Required fields in the report
172
+ fields = [
173
+ "json", "total_tests", "passed", "failed", "errors",
174
+ "skipped", "total_time", "success_rate", "timestamp"
175
+ ]
176
+
177
+ # Validate report structure
178
+ missing = []
179
+ for key in fields:
180
+ if key not in report:
181
+ missing.append(key)
182
+ if missing:
183
+ raise OrionisTestValueError(f"Missing report fields: {missing}")
184
+
185
+ # Insert the report into the database
186
+ self.__connect()
187
+ try:
188
+
189
+ # Query to insert the report into the table
190
+ query = f'''
191
+ INSERT INTO {self.__table_name} (
192
+ json, total_tests, passed, failed, errors,
193
+ skipped, total_time, success_rate, timestamp
194
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
195
+ '''
196
+
197
+ # Execute the insert query with the report data
198
+ cursor = self._conn.cursor()
199
+ cursor.execute(query, (
200
+ json.dumps(report),
201
+ report["total_tests"],
202
+ report["passed"],
203
+ report["failed"],
204
+ report["errors"],
205
+ report["skipped"],
206
+ report["total_time"],
207
+ report["success_rate"],
208
+ report["timestamp"]
209
+ ))
210
+ self._conn.commit()
211
+ return True
212
+ except sqlite3.Error as e:
213
+ if self._conn:
214
+ self._conn.rollback()
215
+ raise OrionisTestPersistenceError(f"Failed to insert report: {e}")
216
+ finally:
217
+ if self._conn:
218
+ self.__close()
219
+ self._conn = None
220
+
221
+ def __getReports(
222
+ self,
223
+ first: Optional[int] = None,
224
+ last: Optional[int] = None
225
+ ) -> List[Tuple]:
226
+ """
227
+ Retrieves a specified number of report records from the database, ordered by their ID.
228
+
229
+ Parameters
230
+ ----------
231
+ first : Optional[int], default=None
232
+ The number of earliest reports to retrieve, ordered ascending by ID.
233
+ last : Optional[int], default=None
234
+ The number of latest reports to retrieve, ordered descending by ID.
235
+
236
+ Returns
237
+ -------
238
+ List[Tuple]
239
+ A list of tuples representing the report records.
240
+
241
+ Raises
242
+ ------
243
+ OrionisTestValueError
244
+ If both 'first' and 'last' are specified, or if either is not a positive integer.
245
+ OrionisTestPersistenceError
246
+ If there is an error retrieving reports from the database.
247
+ """
248
+
249
+ # Validate parameters
250
+ if first is not None and last is not None:
251
+ raise OrionisTestValueError(
252
+ "Cannot specify both 'first' and 'last' parameters. Use one or the other."
253
+ )
254
+ if first is not None:
255
+ if not isinstance(first, int) or first <= 0:
256
+ raise OrionisTestValueError("'first' must be an integer greater than 0.")
257
+ if last is not None:
258
+ if not isinstance(last, int) or last <= 0:
259
+ raise OrionisTestValueError("'last' must be an integer greater than 0.")
260
+
261
+ order = 'DESC' if last is not None else 'ASC'
262
+ quantity = first if first is not None else last
263
+
264
+ self.__connect()
265
+ try:
266
+ cursor = self._conn.cursor()
267
+ query = f"SELECT * FROM {self.__table_name} ORDER BY id {order} LIMIT ?"
268
+ cursor.execute(query, (quantity,))
269
+ results = cursor.fetchall()
270
+ return results
271
+ except sqlite3.Error as e:
272
+ raise OrionisTestPersistenceError(f"Failed to retrieve reports from '{self.__db_name}': {e}")
273
+ finally:
274
+ if self._conn:
275
+ self.__close()
276
+ self._conn = None
277
+
278
+ def __resetDatabase(self) -> bool:
279
+ """
280
+ Resets the database by dropping the existing table.
281
+ This method connects to the database, drops the table specified by
282
+ `self.__table_name` if it exists, commits the changes, and then closes
283
+ the connection. If an error occurs during the process, an
284
+ OrionisTestPersistenceError is raised.
285
+
286
+ Raises
287
+ ------
288
+ OrionisTestPersistenceError
289
+ If the database reset operation fails due to an SQLite error.
290
+
291
+ Returns
292
+ -------
293
+ bool
294
+ True if the database was successfully reset, False otherwise.
295
+ """
296
+
297
+ self.__connect()
298
+ try:
299
+ cursor = self._conn.cursor()
300
+ cursor.execute(f'DROP TABLE IF EXISTS {self.__table_name}')
301
+ self._conn.commit()
302
+ return True
303
+ except sqlite3.Error as e:
304
+ raise OrionisTestPersistenceError(f"Failed to reset database: {e}")
305
+ finally:
306
+ if self._conn:
307
+ self.__close()
308
+ self._conn = None
309
+
310
+ def __close(self) -> None:
311
+ """
312
+ Closes the current database connection.
313
+ This method checks if a database connection exists. If so, it closes the connection and sets the connection attribute to None.
314
+
315
+ Returns
316
+ -------
317
+ None
318
+ """
319
+
320
+ if self._conn:
321
+ self._conn.close()
322
+ self._conn = None
323
+
324
+ def create(self, report: Dict) -> bool:
325
+ """
326
+ Create a new test report in the history database.
327
+
328
+ Parameters
329
+ ----------
330
+ report : Dict
331
+ A dictionary containing the test report data.
332
+
333
+ Returns
334
+ -------
335
+ bool
336
+ True if the report was successfully created, False otherwise.
337
+ """
338
+ self.__createTableIfNotExists()
339
+ return self.__insertReport(report)
340
+
341
+ def reset(self) -> bool:
342
+ """
343
+ Reset the history database by dropping the existing table.
344
+
345
+ Returns
346
+ -------
347
+ bool
348
+ True if the database was successfully reset, False otherwise.
349
+ """
350
+ return self.__resetDatabase()
351
+
352
+ def get(
353
+ self,
354
+ first: Optional[int] = None,
355
+ last: Optional[int] = None
356
+ ) -> List[Tuple]:
357
+ """
358
+ Retrieve test reports from the history database.
359
+
360
+ Parameters
361
+ ----------
362
+ first : Optional[int], default=None
363
+ The number of earliest reports to retrieve, ordered ascending by ID.
364
+ last : Optional[int], default=None
365
+ The number of latest reports to retrieve, ordered descending by ID.
366
+
367
+ Returns
368
+ -------
369
+ List[Tuple]
370
+ A list of tuples representing the retrieved reports.
371
+ """
372
+ return self.__getReports(first, last)
@@ -3,27 +3,43 @@ from abc import ABC, abstractmethod
3
3
  class ITestDumper(ABC):
4
4
  """
5
5
  Interface for standard output debugging utilities.
6
- This interface defines methods for dumping debugging information, capturing the caller's file, method, and line number, and utilizing a Debug class to output the information. Implementations should provide mechanisms to output or log the provided arguments for debugging purposes
6
+
7
+ This interface defines methods for dumping debugging information,
8
+ capturing the caller's file, method, and line number, and utilizing
9
+ a Debug class to output the information.
10
+
11
+ Implementations
12
+ --------------
13
+ Implementations should provide mechanisms to output or log the
14
+ provided arguments for debugging purposes.
7
15
  """
8
16
 
9
17
  @abstractmethod
10
- def dd(self, *args):
18
+ def dd(self, *args) -> None:
11
19
  """
12
20
  Dumps debugging information using the Debug class.
13
- This method captures the caller's file, method, and line number,
21
+
22
+ This method captures the caller's file and line number,
14
23
  and uses the Debug class to output debugging information.
15
- Args:
16
- *args: Variable length argument list to be dumped.
24
+
25
+ Parameters
26
+ ----------
27
+ *args : tuple
28
+ Variable length argument list to be dumped.
17
29
  """
18
30
  pass
19
31
 
20
32
  @abstractmethod
21
- def dump(self, *args):
33
+ def dump(self, *args) -> None:
22
34
  """
23
35
  Dumps debugging information using the Debug class.
36
+
24
37
  This method captures the caller's file, method, and line number,
25
38
  and uses the Debug class to output debugging information.
26
- Args:
27
- *args: Variable length argument list to be dumped.
39
+
40
+ Parameters
41
+ ----------
42
+ *args : tuple
43
+ Variable length argument list to be dumped.
28
44
  """
29
45
  pass
@@ -1,27 +1,46 @@
1
1
  import os
2
2
  import sys
3
+ from orionis.test.exceptions.test_runtime_error import OrionisTestRuntimeError
3
4
  from orionis.test.output.contracts.dumper import ITestDumper
4
5
 
5
6
  class TestDumper(ITestDumper):
6
7
  """
7
8
  TestDumper provides utility methods for debugging and outputting information during test execution.
8
- This class implements methods to determine if an object is a test case instance and to output debugging
9
- information using the Debug class. It ensures that standard output and error streams are properly managed
10
- during debugging dumps, and captures the caller's file and line number for context.
9
+
10
+ This class implements methods to:
11
+ - Determine if an object is a test case instance.
12
+ - Output debugging information using the Debug class.
13
+ - Manage standard output and error streams during debugging dumps.
14
+ - Capture the caller's file and line number for context.
15
+
16
+ Attributes
17
+ ----------
18
+ None
19
+
20
+ Methods
21
+ -------
22
+ __isTestCaseClass(value)
23
+ Determines if the given value is an instance of a test case class.
24
+ dd(*args)
25
+ Dumps debugging information using the Debug class.
26
+ dump(*args)
27
+ Dumps debugging information using the Debug class.
11
28
  """
12
29
 
13
- def __isTestCaseClass(self, value):
30
+ def __isTestCaseClass(self, value) -> bool:
14
31
  """
15
- Determines if the given value is an instance of a test case class.
16
- This method checks whether the provided value is an instance of one of the
17
- predefined test case classes: AsyncTestCase, TestCase, or SyncTestCase.
18
- If the value is None or an ImportError occurs during the import of the
19
- test case classes, the method returns False.
20
- Args:
21
- value: The object to be checked.
22
- Returns:
23
- bool: True if the value is an instance of AsyncTestCase, TestCase,
24
- or SyncTestCase; False otherwise.
32
+ Check if the given value is an instance of a test case class.
33
+
34
+ Parameters
35
+ ----------
36
+ value : object
37
+ The object to check.
38
+
39
+ Returns
40
+ -------
41
+ bool
42
+ True if `value` is an instance of AsyncTestCase, TestCase, or SyncTestCase;
43
+ False otherwise.
25
44
  """
26
45
  try:
27
46
  if value is None:
@@ -33,13 +52,17 @@ class TestDumper(ITestDumper):
33
52
  except Exception:
34
53
  return False
35
54
 
36
- def dd(self, *args):
55
+ def dd(self, *args) -> None:
37
56
  """
38
57
  Dumps debugging information using the Debug class.
39
- This method captures the caller's file, method, and line number,
58
+
59
+ This method captures the caller's file and line number,
40
60
  and uses the Debug class to output debugging information.
41
- Args:
42
- *args: Variable length argument list to be dumped.
61
+
62
+ Parameters
63
+ ----------
64
+ *args : tuple
65
+ Variable length argument list to be dumped.
43
66
  """
44
67
  if not args:
45
68
  return
@@ -62,17 +85,23 @@ class TestDumper(ITestDumper):
62
85
  dumper.dd(*args[1:])
63
86
  else:
64
87
  dumper.dd(*args)
88
+ except Exception as e:
89
+ raise OrionisTestRuntimeError(f"An error occurred while dumping debug information: {e}")
65
90
  finally:
66
91
  sys.stdout = original_stdout
67
92
  sys.stderr = original_stderr
68
93
 
69
- def dump(self, *args):
94
+ def dump(self, *args) -> None:
70
95
  """
71
96
  Dumps debugging information using the Debug class.
97
+
72
98
  This method captures the caller's file, method, and line number,
73
99
  and uses the Debug class to output debugging information.
74
- Args:
75
- *args: Variable length argument list to be dumped.
100
+
101
+ Parameters
102
+ ----------
103
+ *args : tuple
104
+ Variable length argument list to be dumped.
76
105
  """
77
106
  if not args:
78
107
  return
@@ -95,6 +124,8 @@ class TestDumper(ITestDumper):
95
124
  dumper.dump(*args[1:])
96
125
  else:
97
126
  dumper.dump(*args)
127
+ except Exception as e:
128
+ raise OrionisTestRuntimeError(f"An error occurred while dumping debug information: {e}")
98
129
  finally:
99
130
  sys.stdout = original_stdout
100
131
  sys.stderr = original_stderr