orionis 0.229.0__py3-none-any.whl → 0.231.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.
- orionis/framework.py +1 -1
- orionis/luminate/console/output/console.py +29 -1
- orionis/luminate/test/contracts/test_suite.py +23 -18
- orionis/luminate/test/contracts/test_unit.py +1 -1
- orionis/luminate/test/test_suite.py +61 -44
- orionis/luminate/test/test_unit.py +1 -1
- {orionis-0.229.0.dist-info → orionis-0.231.0.dist-info}/METADATA +1 -1
- {orionis-0.229.0.dist-info → orionis-0.231.0.dist-info}/RECORD +12 -12
- {orionis-0.229.0.dist-info → orionis-0.231.0.dist-info}/LICENCE +0 -0
- {orionis-0.229.0.dist-info → orionis-0.231.0.dist-info}/WHEEL +0 -0
- {orionis-0.229.0.dist-info → orionis-0.231.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.229.0.dist-info → orionis-0.231.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
@@ -556,4 +556,32 @@ class Console(IConsole):
|
|
556
556
|
print(f" {ANSIColors.DIM.value}{ANSIColors.ITALIC.value}{ANSIColors.TEXT_WARNING.value}{name}{ANSIColors.TEXT_RESET.value} : {ANSIColors.CYAN.value}{line}{ANSIColors.TEXT_RESET.value}")
|
557
557
|
count_error -= 1
|
558
558
|
|
559
|
-
print("▬" * len(f" [{error_type}] : {error_message}"))
|
559
|
+
print("▬" * len(f" [{error_type}] : {error_message}"))
|
560
|
+
|
561
|
+
@staticmethod
|
562
|
+
def exitSuccess(message: str = None) -> None:
|
563
|
+
"""
|
564
|
+
Exits the program with a success message.
|
565
|
+
|
566
|
+
Parameters
|
567
|
+
----------
|
568
|
+
message : str, optional
|
569
|
+
The success message to print before exiting.
|
570
|
+
"""
|
571
|
+
if message:
|
572
|
+
Console.success(message)
|
573
|
+
sys.exit(0)
|
574
|
+
|
575
|
+
@staticmethod
|
576
|
+
def exitError(message: str = None) -> None:
|
577
|
+
"""
|
578
|
+
Exits the program with an error message.
|
579
|
+
|
580
|
+
Parameters
|
581
|
+
----------
|
582
|
+
message : str, optional
|
583
|
+
The error message to print before exiting.
|
584
|
+
"""
|
585
|
+
if message:
|
586
|
+
Console.error(message)
|
587
|
+
sys.exit(1)
|
@@ -1,37 +1,42 @@
|
|
1
|
-
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
3
|
+
class ITestSuite(ABC):
|
2
4
|
"""
|
3
5
|
Provides utility methods to configure and execute unit tests from specified folders.
|
4
6
|
"""
|
5
7
|
|
6
8
|
@staticmethod
|
7
|
-
|
9
|
+
@abstractmethod
|
10
|
+
def load(
|
11
|
+
base_path: str = 'tests',
|
12
|
+
folder_path: list | str = '*',
|
13
|
+
pattern: str = 'test_*.py'
|
14
|
+
):
|
8
15
|
"""
|
9
|
-
|
16
|
+
Discover and initialize a test suite from the specified folder(s).
|
17
|
+
|
18
|
+
This method scans the provided folder(s) for test files matching the given pattern
|
19
|
+
and initializes a test suite with the discovered files.
|
10
20
|
|
11
21
|
Parameters
|
12
22
|
----------
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Whether to print test results to the console.
|
21
|
-
|
22
|
-
throw_exception : bool, default=False
|
23
|
-
Whether to raise exceptions on test failures.
|
23
|
+
base_path : str, optional
|
24
|
+
The base path for the tests. Defaults to 'tests'.
|
25
|
+
folder_path : str or list of str, optional
|
26
|
+
Path(s) to the folder(s) containing test files. Use '*' to scan all folders
|
27
|
+
under the base path. Defaults to '*'.
|
28
|
+
pattern : str, optional
|
29
|
+
File pattern to match test files. Defaults to 'test_*.py'.
|
24
30
|
|
25
31
|
Returns
|
26
32
|
-------
|
27
33
|
UnitTestClass
|
28
|
-
|
34
|
+
An initialized test suite containing the discovered test files.
|
29
35
|
|
30
36
|
Raises
|
31
37
|
------
|
32
38
|
TypeError
|
33
|
-
If `
|
34
|
-
|
35
|
-
If any dictionary lacks required keys: 'folder_path', 'base_path', or 'pattern'.
|
39
|
+
If `base_path` is not a string, `folder_path` is not a string or list, or
|
40
|
+
`pattern` is not a string.
|
36
41
|
"""
|
37
42
|
pass
|
@@ -1,68 +1,85 @@
|
|
1
|
-
|
1
|
+
import re
|
2
|
+
from os import walk
|
3
|
+
from orionis.luminate.test.contracts.test_suite import ITestSuite
|
2
4
|
from orionis.luminate.test.test_unit import UnitTest as UnitTestClass
|
3
5
|
|
4
|
-
class
|
6
|
+
class TestSuite(ITestSuite):
|
5
7
|
"""
|
6
8
|
A class containing test utility methods.
|
7
|
-
|
8
|
-
Methods
|
9
|
-
-------
|
10
|
-
folders(folders: list) -> UnitTestClass
|
11
|
-
Validates folder configurations and initializes test suite.
|
12
9
|
"""
|
13
10
|
|
14
11
|
@staticmethod
|
15
|
-
def
|
12
|
+
def load(
|
13
|
+
base_path: str = 'tests',
|
14
|
+
folder_path: list | str = '*',
|
15
|
+
pattern: str = 'test_*.py'
|
16
|
+
) -> UnitTestClass:
|
16
17
|
"""
|
17
|
-
|
18
|
+
Discover and initialize a test suite from the specified folder(s).
|
19
|
+
|
20
|
+
This method scans the provided folder(s) for test files matching the given pattern
|
21
|
+
and initializes a test suite with the discovered files.
|
18
22
|
|
19
23
|
Parameters
|
20
24
|
----------
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
File pattern to match test files
|
25
|
+
base_path : str, optional
|
26
|
+
The base path for the tests. Defaults to 'tests'.
|
27
|
+
folder_path : str or list of str, optional
|
28
|
+
Path(s) to the folder(s) containing test files. Use '*' to scan all folders
|
29
|
+
under the base path. Defaults to '*'.
|
30
|
+
pattern : str, optional
|
31
|
+
File pattern to match test files. Defaults to 'test_*.py'.
|
29
32
|
|
30
33
|
Returns
|
31
34
|
-------
|
32
35
|
UnitTestClass
|
33
|
-
|
36
|
+
An initialized test suite containing the discovered test files.
|
34
37
|
|
35
38
|
Raises
|
36
39
|
------
|
37
40
|
TypeError
|
38
|
-
If
|
39
|
-
|
40
|
-
If any folder dictionary is missing required keys
|
41
|
-
|
42
|
-
Examples
|
43
|
-
--------
|
44
|
-
>>> Tests.folders([
|
45
|
-
... {
|
46
|
-
... 'folder_path': 'example',
|
47
|
-
... 'base_path': 'tests',
|
48
|
-
... 'pattern': 'test_*.py'
|
49
|
-
... }
|
50
|
-
... ])
|
41
|
+
If `base_path` is not a string, `folder_path` is not a string or list, or
|
42
|
+
`pattern` is not a string.
|
51
43
|
"""
|
52
|
-
|
53
|
-
|
44
|
+
# Validate parameters
|
45
|
+
if not isinstance(base_path, str):
|
46
|
+
raise TypeError("base_path must be a string")
|
47
|
+
if not isinstance(folder_path, (str, list)):
|
48
|
+
raise TypeError("folder_path must be a string or a list")
|
49
|
+
if not isinstance(pattern, str):
|
50
|
+
raise TypeError("pattern must be a string")
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
# Helper function to list folders matching the pattern
|
53
|
+
def list_matching_folders(custom_path: str, pattern: str):
|
54
|
+
matched_folders = []
|
55
|
+
for root, _, files in walk(custom_path):
|
56
|
+
for file in files:
|
57
|
+
if re.fullmatch(pattern.replace('*', '.*').replace('?', '.'), file):
|
58
|
+
relative_path = root.replace(base_path, '').replace('\\', '/').lstrip('/')
|
59
|
+
if relative_path not in matched_folders:
|
60
|
+
matched_folders.append(relative_path)
|
61
|
+
return matched_folders
|
60
62
|
|
63
|
+
# Discover folders
|
64
|
+
discovered_folders = []
|
65
|
+
if folder_path == '*':
|
66
|
+
discovered_folders.extend(list_matching_folders(base_path, pattern))
|
67
|
+
elif isinstance(folder_path, list):
|
68
|
+
for custom_path in folder_path:
|
69
|
+
discovered_folders.extend(list_matching_folders(custom_path, pattern))
|
70
|
+
else:
|
71
|
+
discovered_folders.extend(list_matching_folders(folder_path, pattern))
|
72
|
+
|
73
|
+
# Initialize the test suite
|
61
74
|
tests = UnitTestClass()
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
75
|
+
|
76
|
+
# Add discovered folders to the test suite
|
77
|
+
for folder in discovered_folders:
|
78
|
+
tests.discoverTestsInFolder(
|
79
|
+
base_path=base_path,
|
80
|
+
folder_path=folder,
|
81
|
+
pattern=pattern
|
67
82
|
)
|
68
|
-
|
83
|
+
|
84
|
+
# Return the initialized test suite
|
85
|
+
return tests
|
@@ -1,6 +1,6 @@
|
|
1
1
|
orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
orionis/console.py,sha256=4gYWxf0fWYgJ4RKwARvnTPh06FL3GJ6SAZ7R2NzOICw,1342
|
3
|
-
orionis/framework.py,sha256=
|
3
|
+
orionis/framework.py,sha256=N03ehWIO3Lpa18h6NyDaoi8pIFeyLEn9PPlGQObIxxU,1458
|
4
4
|
orionis/installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
orionis/installer/manager.py,sha256=Li4TVziRXWfum02xNG4JHwbnLk-u8xzHjdqKz-D894k,2755
|
6
6
|
orionis/installer/output.py,sha256=7O9qa2xtXMB_4ZvVi-Klneom9YazwygAd_4uYAoxhbU,8548
|
@@ -39,7 +39,7 @@ orionis/luminate/console/exceptions/cli_exception.py,sha256=HsZ_vSeNiJWQ0gznVFNc
|
|
39
39
|
orionis/luminate/console/exceptions/cli_runtime_error.py,sha256=DaCDGu6mXBk1LIzc7cwRROw1mePAigPNASjNZHhUSBE,1154
|
40
40
|
orionis/luminate/console/exceptions/cli_schedule_exception.py,sha256=IBbXb_5zi02pyo1laHdjGn6FYZK7WWRp4j2fkZOCT6I,1161
|
41
41
|
orionis/luminate/console/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
|
-
orionis/luminate/console/output/console.py,sha256=
|
42
|
+
orionis/luminate/console/output/console.py,sha256=aVvcGkzetJ66RLet2H5RZ-xidRH_MfJjKX7vSGkjkSg,18926
|
43
43
|
orionis/luminate/console/output/executor.py,sha256=-efhCbWOS4ZqmRsO0s3j5NEbw4I9hVROF8Q3Atx77zs,3369
|
44
44
|
orionis/luminate/console/output/progress_bar.py,sha256=ZiPGcUaN3EINeLRKgLGtS1GAb1XWlCDx7wFQ7Ff0hqY,3096
|
45
45
|
orionis/luminate/console/output/styles.py,sha256=6a4oQCOBOKMh2ARdeq5GlIskJ3wjiylYmh66tUKKmpQ,4053
|
@@ -200,12 +200,12 @@ orionis/luminate/test/test_exception.py,sha256=21PILTXnMuL5-wT3HGKjIklt8VeIYDcQD
|
|
200
200
|
orionis/luminate/test/test_result.py,sha256=Px2_M70r_y7BntRITk_h0IPTbSTW5XhDyklMKHm3JJI,999
|
201
201
|
orionis/luminate/test/test_status.py,sha256=vNKRmp1lud_ZGTayf3A8wO_0vEYdFABy_oMw-RcEc1c,673
|
202
202
|
orionis/luminate/test/test_std_out.py,sha256=rPwXCf3qvMzkZHRCu03KvLCfD4K7cPOB02BZNpXtaiU,2851
|
203
|
-
orionis/luminate/test/test_suite.py,sha256=
|
204
|
-
orionis/luminate/test/test_unit.py,sha256=
|
203
|
+
orionis/luminate/test/test_suite.py,sha256=olhQfsX1Q_koPetFxZ8gPSz_rk-El37X8H-sI_RXaBg,3282
|
204
|
+
orionis/luminate/test/test_unit.py,sha256=YZfNNQy8jN5FRwa0qlNE3LW88nAxPvzGkh5Jbam6oaQ,12158
|
205
205
|
orionis/luminate/test/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
206
206
|
orionis/luminate/test/contracts/test_std_out.py,sha256=ryvMotj-rpVKOsyGqW0B0IEHuF8DdQj1Rn0K8xiyBOE,489
|
207
|
-
orionis/luminate/test/contracts/test_suite.py,sha256=
|
208
|
-
orionis/luminate/test/contracts/test_unit.py,sha256=
|
207
|
+
orionis/luminate/test/contracts/test_suite.py,sha256=TOIys-Z1HllUJe-qMY9mOfZGiZPXlKRuAZtJ-B2iDz8,1375
|
208
|
+
orionis/luminate/test/contracts/test_unit.py,sha256=CD4FHslmWt1yPbfBhZBsG1QPzGmwKQPkL5cFvJgeilo,2624
|
209
209
|
orionis/static/ascii/icon.ascii,sha256=IgrlVjcYxcCrr0cJuJkOnEz0aEdAQBTyLzO5ainKsWc,398
|
210
210
|
orionis/static/ascii/info.ascii,sha256=HF_o2eXaiw5iqcOhHfnPByn5GJ_O2eBwSK3IpTfYOwY,457
|
211
211
|
orionis/static/bg/galaxy.jpg,sha256=_FuPghOe9LBrIWv1eKZ9fiZR72sEz5obvXGDnD7MzTc,172244
|
@@ -249,9 +249,9 @@ tests/support/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
249
249
|
tests/support/patterns/test_singleton.py,sha256=U5uwpgGcP7-fIazsnFLwg30mmc24S62udhVIHuL-scY,634
|
250
250
|
tests/support/standard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
251
251
|
tests/support/standard/test_std.py,sha256=bJ5LV_OKEEZa_Bk3PTk9Kapk6qECLzcKf0hfR_x2QqM,2042
|
252
|
-
orionis-0.
|
253
|
-
orionis-0.
|
254
|
-
orionis-0.
|
255
|
-
orionis-0.
|
256
|
-
orionis-0.
|
257
|
-
orionis-0.
|
252
|
+
orionis-0.231.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
253
|
+
orionis-0.231.0.dist-info/METADATA,sha256=2pqpyP5KUXDaYxwy7LDaeiXSoiLgz63YsUh3SujLclk,3003
|
254
|
+
orionis-0.231.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
255
|
+
orionis-0.231.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
|
256
|
+
orionis-0.231.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
257
|
+
orionis-0.231.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|