cli-test-framework 0.3.3__tar.gz → 0.3.5__tar.gz

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 (59) hide show
  1. {cli_test_framework-0.3.3/src/cli_test_framework.egg-info → cli_test_framework-0.3.5}/PKG-INFO +17 -4
  2. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/README.md +16 -3
  3. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/docs/user_manual.md +1 -1
  4. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/setup.py +1 -1
  5. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/commands/compare.py +3 -0
  6. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/factory.py +1 -1
  7. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/h5_comparator.py +33 -2
  8. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5/src/cli_test_framework.egg-info}/PKG-INFO +17 -4
  9. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/CHANGELOG.md +0 -0
  10. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/MANIFEST.in +0 -0
  11. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/pyproject.toml +0 -0
  12. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/setup.cfg +0 -0
  13. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/__init__.py +0 -0
  14. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/cli.py +0 -0
  15. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/commands/__init__.py +0 -0
  16. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/core/__init__.py +0 -0
  17. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/core/assertions.py +0 -0
  18. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/core/base_runner.py +0 -0
  19. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/core/parallel_runner.py +0 -0
  20. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/core/process_worker.py +0 -0
  21. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/core/setup.py +0 -0
  22. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/core/test_case.py +0 -0
  23. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/__init__.py +0 -0
  24. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/base_comparator.py +0 -0
  25. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/binary_comparator.py +0 -0
  26. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/csv_comparator.py +0 -0
  27. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/json_comparator.py +0 -0
  28. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/result.py +0 -0
  29. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/text_comparator.py +0 -0
  30. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/file_comparator/xml_comparator.py +0 -0
  31. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/runners/__init__.py +0 -0
  32. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/runners/json_runner.py +0 -0
  33. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/runners/parallel_json_runner.py +0 -0
  34. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/runners/yaml_runner.py +0 -0
  35. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/utils/__init__.py +0 -0
  36. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/utils/path_resolver.py +0 -0
  37. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework/utils/report_generator.py +0 -0
  38. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework.egg-info/SOURCES.txt +0 -0
  39. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework.egg-info/dependency_links.txt +0 -0
  40. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework.egg-info/entry_points.txt +0 -0
  41. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework.egg-info/requires.txt +0 -0
  42. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/src/cli_test_framework.egg-info/top_level.txt +0 -0
  43. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/__init__.py +0 -0
  44. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/__pycache__/__init__.cpython-312.pyc +0 -0
  45. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/__pycache__/test_parallel_runner.cpython-312-pytest-7.4.4.pyc +0 -0
  46. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/__pycache__/test_setup_module.cpython-312-pytest-7.4.4.pyc +0 -0
  47. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/fixtures/test_cases.json +0 -0
  48. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/fixtures/test_cases.yaml +0 -0
  49. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/fixtures/test_cases1.json +0 -0
  50. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/fixtures/test_with_setup.json +0 -0
  51. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/fixtures/test_with_setup.yaml +0 -0
  52. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/performance_test.py +0 -0
  53. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/test1.py +0 -0
  54. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/test_comprehensive_space.py +0 -0
  55. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/test_parallel_runner.py +0 -0
  56. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/test_parallel_space.py +0 -0
  57. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/test_report.txt +0 -0
  58. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/test_runners.py +0 -0
  59. {cli_test_framework-0.3.3 → cli_test_framework-0.3.5}/tests/test_setup_module.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cli-test-framework
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: A powerful command line testing framework in Python with setup modules, parallel execution, and file comparison capabilities.
5
5
  Home-page: https://github.com/ozil111/cli-test-framework
6
6
  Author: Xiaotong Wang
@@ -60,7 +60,7 @@ This is a lightweight and extensible automated testing framework that supports d
60
60
 
61
61
  ```bash
62
62
  pip install cli-test-framework
63
- Python >= 3.6
63
+ Python >= 3.9
64
64
  ```
65
65
 
66
66
  ### Sequential Execution
@@ -214,12 +214,25 @@ compare-files data1.json data2.json \
214
214
  ```
215
215
 
216
216
  #### HDF5 Comparison
217
+
218
+ **New Feature**: HDF5 group path expansion! By default, when you specify a group path in `--h5-table`, the comparator will automatically expand and compare all datasets and subgroups within that path.
219
+
217
220
  ```bash
221
+ # Compare specific tables/groups with auto-expansion (default behavior)
218
222
  compare-files data1.h5 data2.h5 \
219
- --h5-table table1,table2 \
220
- --h5-structure-only \
223
+ --h5-table group1/subgroupA \
221
224
  --h5-rtol 1e-5 \
222
225
  --h5-atol 1e-8
226
+
227
+ # Disable auto-expansion to compare only the specified path itself
228
+ compare-files data1.h5 data2.h5 \
229
+ --h5-table group1 \
230
+ --h5-no-expand-path
231
+
232
+ # Use regex patterns (also supports auto-expansion)
233
+ compare-files data1.h5 data2.h5 \
234
+ --h5-table-regex "group1/.*" \
235
+ --h5-structure-only
223
236
  ```
224
237
 
225
238
  #### Binary Comparison
@@ -25,7 +25,7 @@ This is a lightweight and extensible automated testing framework that supports d
25
25
 
26
26
  ```bash
27
27
  pip install cli-test-framework
28
- Python >= 3.6
28
+ Python >= 3.9
29
29
  ```
30
30
 
31
31
  ### Sequential Execution
@@ -179,12 +179,25 @@ compare-files data1.json data2.json \
179
179
  ```
180
180
 
181
181
  #### HDF5 Comparison
182
+
183
+ **New Feature**: HDF5 group path expansion! By default, when you specify a group path in `--h5-table`, the comparator will automatically expand and compare all datasets and subgroups within that path.
184
+
182
185
  ```bash
186
+ # Compare specific tables/groups with auto-expansion (default behavior)
183
187
  compare-files data1.h5 data2.h5 \
184
- --h5-table table1,table2 \
185
- --h5-structure-only \
188
+ --h5-table group1/subgroupA \
186
189
  --h5-rtol 1e-5 \
187
190
  --h5-atol 1e-8
191
+
192
+ # Disable auto-expansion to compare only the specified path itself
193
+ compare-files data1.h5 data2.h5 \
194
+ --h5-table group1 \
195
+ --h5-no-expand-path
196
+
197
+ # Use regex patterns (also supports auto-expansion)
198
+ compare-files data1.h5 data2.h5 \
199
+ --h5-table-regex "group1/.*" \
200
+ --h5-structure-only
188
201
  ```
189
202
 
190
203
  #### Binary Comparison
@@ -27,7 +27,7 @@ The CLI Testing Framework is a powerful tool designed for testing command-line a
27
27
  ## Installation
28
28
 
29
29
  ### Prerequisites
30
- - Python 3.6 or higher
30
+ - Python 3.9 or higher
31
31
  - pip package manager
32
32
 
33
33
  ### Basic Installation
@@ -8,7 +8,7 @@ with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
8
8
 
9
9
  setup(
10
10
  name="cli-test-framework",
11
- version="0.3.3",
11
+ version="0.3.5",
12
12
  author="Xiaotong Wang",
13
13
  author_email="xiaotongwang98@gmail.com",
14
14
  description="A powerful command line testing framework in Python with setup modules, parallel execution, and file comparison capabilities.",
@@ -67,6 +67,8 @@ def parse_arguments():
67
67
  help="Relative tolerance for numerical comparison in HDF5 files")
68
68
  h5_group.add_argument("--h5-atol", type=float, default=1e-8,
69
69
  help="Absolute tolerance for numerical comparison in HDF5 files")
70
+ h5_group.add_argument("--h5-no-expand-path", dest="h5_expand_path", action="store_false",
71
+ help="Do not expand HDF5 group paths to compare all sub-items.")
70
72
 
71
73
  return parser.parse_args()
72
74
 
@@ -148,6 +150,7 @@ def main():
148
150
  comparator_kwargs["show_content_diff"] = args.h5_show_content_diff
149
151
  comparator_kwargs["rtol"] = args.h5_rtol
150
152
  comparator_kwargs["atol"] = args.h5_atol
153
+ comparator_kwargs["expand_path"] = args.h5_expand_path
151
154
 
152
155
  if file_type == "binary":
153
156
  comparator_kwargs["similarity"] = args.similarity
@@ -65,7 +65,7 @@ class ComparatorFactory:
65
65
  if file_type.lower() == 'h5':
66
66
  # H5 comparator accepts specific parameters
67
67
  h5_kwargs = {k: v for k, v in kwargs.items()
68
- if k in ['tables', 'table_regex', 'encoding', 'chunk_size', 'verbose', 'structure_only', 'show_content_diff', 'debug', 'rtol', 'atol']}
68
+ if k in ['tables', 'table_regex', 'encoding', 'chunk_size', 'verbose', 'structure_only', 'show_content_diff', 'debug', 'rtol', 'atol', 'expand_path']}
69
69
  return comparator_class(**h5_kwargs)
70
70
  elif file_type.lower() == 'binary':
71
71
  # Binary comparator accepts all parameters, including num_threads
@@ -5,7 +5,7 @@ import logging
5
5
  import re
6
6
 
7
7
  class H5Comparator(BaseComparator):
8
- def __init__(self, tables=None, table_regex=None, structure_only=False, show_content_diff=False, debug=False, rtol=1e-5, atol=1e-8, **kwargs):
8
+ def __init__(self, tables=None, table_regex=None, structure_only=False, show_content_diff=False, debug=False, rtol=1e-5, atol=1e-8, expand_path=True, **kwargs):
9
9
  """
10
10
  Initialize H5 comparator
11
11
  :param tables: List of table names to compare. If None, compare all tables
@@ -15,6 +15,7 @@ class H5Comparator(BaseComparator):
15
15
  :param debug: If True, enable debug mode
16
16
  :param rtol: Relative tolerance for numerical comparison
17
17
  :param atol: Absolute tolerance for numerical comparison
18
+ :param expand_path: If True, expand group paths to compare all sub-items. Defaults to True.
18
19
  """
19
20
  super().__init__(**kwargs)
20
21
  self.tables = tables
@@ -23,18 +24,20 @@ class H5Comparator(BaseComparator):
23
24
  self.show_content_diff = show_content_diff
24
25
  self.rtol = rtol
25
26
  self.atol = atol
27
+ self.expand_path = expand_path
26
28
 
27
29
  # Set debug level if verbose is enabled
28
30
  if kwargs.get('verbose', False) or debug:
29
31
  self.logger.setLevel(logging.DEBUG)
30
32
 
31
- self.logger.debug(f"Initialized H5Comparator with structure_only={structure_only}, show_content_diff={show_content_diff}, rtol={rtol}, atol={atol}")
33
+ self.logger.debug(f"Initialized H5Comparator with structure_only={structure_only}, show_content_diff={show_content_diff}, rtol={rtol}, atol={atol}, expand_path={expand_path}")
32
34
  if table_regex:
33
35
  self.logger.debug(f"Using table regex pattern: {table_regex}")
34
36
 
35
37
  def read_content(self, file_path, start_line=0, end_line=None, start_column=0, end_column=None):
36
38
  """Read H5 file content"""
37
39
  content = {}
40
+ processed_paths = set()
38
41
 
39
42
  # Log whether we're in structure-only mode
40
43
  self.logger.debug(f"Reading file {file_path} in structure-only mode: {self.structure_only}")
@@ -44,6 +47,10 @@ class H5Comparator(BaseComparator):
44
47
  with h5py.File(file_path, 'r') as f:
45
48
  # Function to collect structure information
46
49
  def collect_structure(name, obj):
50
+ if name in processed_paths:
51
+ self.logger.debug(f"Path {name} already processed, skipping.")
52
+ return
53
+
47
54
  if isinstance(obj, h5py.Dataset):
48
55
  content[name] = {
49
56
  'type': 'dataset',
@@ -52,6 +59,7 @@ class H5Comparator(BaseComparator):
52
59
  'attrs': dict(obj.attrs)
53
60
  }
54
61
  self.logger.debug(f"Collected structure for dataset: {name}")
62
+ processed_paths.add(name)
55
63
  elif isinstance(obj, h5py.Group) and name: # Skip root group
56
64
  content[name] = {
57
65
  'type': 'group',
@@ -59,9 +67,14 @@ class H5Comparator(BaseComparator):
59
67
  'attrs': dict(obj.attrs)
60
68
  }
61
69
  self.logger.debug(f"Collected structure for group: {name}")
70
+ processed_paths.add(name)
62
71
 
63
72
  # Function to collect structure and data
64
73
  def collect_structure_and_data(name, obj):
74
+ if name in processed_paths:
75
+ self.logger.debug(f"Path {name} already processed, skipping.")
76
+ return
77
+
65
78
  if isinstance(obj, h5py.Dataset):
66
79
  dataset_info = {
67
80
  'type': 'dataset',
@@ -94,6 +107,7 @@ class H5Comparator(BaseComparator):
94
107
  self.logger.error(f"Error reading data from {name}: {str(e)}")
95
108
 
96
109
  content[name] = dataset_info
110
+ processed_paths.add(name)
97
111
 
98
112
  elif isinstance(obj, h5py.Group) and name: # Skip root group
99
113
  content[name] = {
@@ -102,6 +116,7 @@ class H5Comparator(BaseComparator):
102
116
  'attrs': dict(obj.attrs)
103
117
  }
104
118
  self.logger.debug(f"Collected structure for group: {name}")
119
+ processed_paths.add(name)
105
120
 
106
121
  if self.tables or self.table_regex:
107
122
  # If specific tables or regex pattern is specified
@@ -134,10 +149,26 @@ class H5Comparator(BaseComparator):
134
149
 
135
150
  def process_item(name, item):
136
151
  try:
152
+ # Process the current item first
137
153
  if self.structure_only:
138
154
  collect_structure(name, item)
139
155
  else:
140
156
  collect_structure_and_data(name, item)
157
+
158
+ # If it's a group and expand_path is enabled, visit all its members
159
+ if self.expand_path and isinstance(item, h5py.Group):
160
+ self.logger.debug(f"Expanding group path: {name}")
161
+
162
+ def visitor(sub_name, sub_obj):
163
+ full_path = f"{name}/{sub_name}"
164
+ self.logger.debug(f"Processing sub-item from expansion: {full_path}")
165
+ if self.structure_only:
166
+ collect_structure(full_path, sub_obj)
167
+ else:
168
+ collect_structure_and_data(full_path, sub_obj)
169
+
170
+ item.visititems(visitor)
171
+
141
172
  except Exception as e:
142
173
  self.logger.error(f"Error processing {name}: {str(e)}")
143
174
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cli-test-framework
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: A powerful command line testing framework in Python with setup modules, parallel execution, and file comparison capabilities.
5
5
  Home-page: https://github.com/ozil111/cli-test-framework
6
6
  Author: Xiaotong Wang
@@ -60,7 +60,7 @@ This is a lightweight and extensible automated testing framework that supports d
60
60
 
61
61
  ```bash
62
62
  pip install cli-test-framework
63
- Python >= 3.6
63
+ Python >= 3.9
64
64
  ```
65
65
 
66
66
  ### Sequential Execution
@@ -214,12 +214,25 @@ compare-files data1.json data2.json \
214
214
  ```
215
215
 
216
216
  #### HDF5 Comparison
217
+
218
+ **New Feature**: HDF5 group path expansion! By default, when you specify a group path in `--h5-table`, the comparator will automatically expand and compare all datasets and subgroups within that path.
219
+
217
220
  ```bash
221
+ # Compare specific tables/groups with auto-expansion (default behavior)
218
222
  compare-files data1.h5 data2.h5 \
219
- --h5-table table1,table2 \
220
- --h5-structure-only \
223
+ --h5-table group1/subgroupA \
221
224
  --h5-rtol 1e-5 \
222
225
  --h5-atol 1e-8
226
+
227
+ # Disable auto-expansion to compare only the specified path itself
228
+ compare-files data1.h5 data2.h5 \
229
+ --h5-table group1 \
230
+ --h5-no-expand-path
231
+
232
+ # Use regex patterns (also supports auto-expansion)
233
+ compare-files data1.h5 data2.h5 \
234
+ --h5-table-regex "group1/.*" \
235
+ --h5-structure-only
223
236
  ```
224
237
 
225
238
  #### Binary Comparison