baldertest 0.1.0b13__py3-none-any.whl → 0.1.0b14__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.
_balder/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.1.0b13'
21
- __version_tuple__ = version_tuple = (0, 1, 0)
20
+ __version__ = version = '0.1.0b14'
21
+ __version_tuple__ = version_tuple = (0, 1, 0, 'b14')
_balder/collector.py CHANGED
@@ -143,6 +143,26 @@ class Collector:
143
143
  raise AttributeError("please call the `collect()` method before omitting this value")
144
144
  return self._all_collected_setups
145
145
 
146
+ @property
147
+ def all_collected_scenarios_with_mro(self) -> List[Type[Scenario] | Type[object]]:
148
+ """returns a list of all collected scenarios that were found by the collector incl. all parent classes"""
149
+ if self._all_collected_scenarios is None:
150
+ raise AttributeError("please call the `collect()` method before omitting this value")
151
+ available_classes_with_mro = []
152
+ for cur_class in self._all_collected_scenarios:
153
+ available_classes_with_mro.extend([*inspect.getmro(cur_class)])
154
+ return list(set(available_classes_with_mro))
155
+
156
+ @property
157
+ def all_collected_setups_with_mro(self) -> List[Type[Setup] | Type[object]]:
158
+ """returns a list of all collected setups that were found by the collector incl. all parent classes"""
159
+ if self._all_collected_setups is None:
160
+ raise AttributeError("please call the `collect()` method before omitting this value")
161
+ available_classes_with_mro = []
162
+ for cur_class in self._all_collected_setups:
163
+ available_classes_with_mro.extend([*inspect.getmro(cur_class)])
164
+ return list(set(available_classes_with_mro))
165
+
146
166
  @property
147
167
  def all_scenarios(self) -> List[Type[Scenario]]:
148
168
  """returns a list of all scenarios that were found by the collector"""
@@ -174,17 +194,18 @@ class Collector:
174
194
  raise AttributeError("please call the `collect()` method before omitting this value")
175
195
  return self._all_connections
176
196
 
177
- def get_class_and_method_type_for(self, func) -> Tuple[Union[type, None], MethodLiteralType]:
197
+ def get_class_and_method_type_for(self, func) -> Tuple[Union[type, None], MethodLiteralType] | None:
178
198
  """
179
199
  This helper function returns the related class and the type of the method (`staticmethod`, `classmethod`,
180
200
  `instancemethod` or `function`) as tuple.
181
- """
201
+ The method returns None if the provided element isn't a method of a valid :class:`Scenario` / :class:`Setup`
202
+ class.
182
203
 
183
- available_classes = self.all_collected_scenarios + self.all_collected_setups
184
- available_classes_with_mro = []
185
- for cur_class in available_classes:
186
- available_classes_with_mro.extend([*inspect.getmro(cur_class)])
187
- available_classes_with_mro = set(available_classes_with_mro)
204
+ :param func: the function/method the class/function type should be returned for
205
+ :return: tuple with the class (or None for functions) and the method type or None if this function/method is not
206
+ part of any known and active scenario/setup or their parent classes
207
+ """
208
+ available_classes_with_mro = self.all_collected_scenarios_with_mro + self.all_collected_setups_with_mro
188
209
 
189
210
  qualname = func.__qualname__
190
211
 
@@ -195,7 +216,7 @@ class Collector:
195
216
  for cur_class in available_classes_with_mro:
196
217
  if cur_class.__qualname__ == expected_class_name:
197
218
  return cur_class, get_method_type(cur_class, func)
198
- raise ValueError(f'function {func.__qualname__} is not part of any scenario or setup')
219
+ return None
199
220
 
200
221
  def get_fixture_manager(self) -> FixtureManager:
201
222
  """
@@ -203,15 +224,17 @@ class Collector:
203
224
  :return: the fixture manager that is valid for this session
204
225
  """
205
226
  resolved_dict = {}
206
- for cur_level_as_str, cur_module_fixture_dict in self._raw_fixtures.items():
227
+ for cur_level_as_str, all_fixture_callable_of_that_level in self._raw_fixtures.items():
207
228
  cur_level = FixtureExecutionLevel(cur_level_as_str)
208
229
  resolved_dict[cur_level] = {}
209
- for cur_fn in cur_module_fixture_dict:
210
- cls, func_type = self.get_class_and_method_type_for(cur_fn)
211
- # mechanism also works for balderglob fixtures (`func_type` is 'function' and `cls` is None)
212
- if cls not in resolved_dict[cur_level].keys():
213
- resolved_dict[cur_level][cls] = []
214
- resolved_dict[cur_level][cls].append((func_type, cur_fn))
230
+ for cur_callable in all_fixture_callable_of_that_level:
231
+ callable_meth_type_tuple = self.get_class_and_method_type_for(cur_callable)
232
+ if callable_meth_type_tuple:
233
+ cls, func_type = callable_meth_type_tuple
234
+ # mechanism also works for balderglob fixtures (`func_type` is 'function' and `cls` is None)
235
+ if cls not in resolved_dict[cur_level].keys():
236
+ resolved_dict[cur_level][cls] = []
237
+ resolved_dict[cur_level][cls].append((func_type, cur_callable))
215
238
  return FixtureManager(resolved_dict)
216
239
 
217
240
  def load_balderglob_py_file(self) -> Union[types.ModuleType, None]:
@@ -77,7 +77,7 @@ def get_method_type(func_class, func) -> MethodLiteralType:
77
77
  expected_class_qualname = func.__qualname__.rpartition('.')[0]
78
78
 
79
79
  def get_for(the_class):
80
- if the_class.__qualname__ == expected_class_qualname:
80
+ if func.__name__ in the_class.__dict__.keys() and the_class.__qualname__ == expected_class_qualname:
81
81
  fn_type = the_class.__dict__.get(func.__name__)
82
82
 
83
83
  if isinstance(fn_type, classmethod):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: baldertest
3
- Version: 0.1.0b13
3
+ Version: 0.1.0b14
4
4
  Summary: balder: reusable scenario based test framework
5
5
  Home-page: https://docs.balder.dev
6
6
  Author: Max Stahlschmidt and others
@@ -1,9 +1,9 @@
1
1
  _balder/__init__.py,sha256=Qk4wkVInPlXLFV36Yco5K7PDawJoeeWQVakzj6g5pmA,195
2
- _balder/_version.py,sha256=RidGLONbtMyaeTxRFsnFoG0JART6r-D1DZSuTpS3ikw,514
2
+ _balder/_version.py,sha256=g5k4tbPdhrhEa3D2X-tMb0NvEt7IbfLQzEQ3Vp3Tq9w,521
3
3
  _balder/balder_plugin.py,sha256=EQzJP1dwwVDydhMLJtAmTCXOczlDuXBJur05lalmK_k,3136
4
4
  _balder/balder_session.py,sha256=ezT86gC_VzPQZOQ4r5qQ75IEm6rXZHiIpEqZDczkRsE,16149
5
5
  _balder/balder_settings.py,sha256=U96PVep7dGSaTXrMfeZMYf6oCIcEDPEqrBlFcoX476s,582
6
- _balder/collector.py,sha256=rWpr7ZD64Dki-um7GaXlt9R_Jxl6E9OqTmMRSriDolg,44578
6
+ _balder/collector.py,sha256=vjqU8suydg_s_YHEXt-KieR8gMzs9_KWDvgL62KJ0UI,46070
7
7
  _balder/connection.py,sha256=X0zGAsAywNFck-DBie38N-9sJLAde7UJ0qYuHaiO5GE,40775
8
8
  _balder/connection_metadata.py,sha256=FrTj6NNBBUl6QuFx8DWy6HRueufXB93WTBkdc41uFaE,13632
9
9
  _balder/decorator_connect.py,sha256=-DDHzTtEZVSHXAQNmqnu3x2gfOJu08Lq4piBDQ1R0no,5857
@@ -72,7 +72,7 @@ _balder/objects/connections/osi_7_application.py,sha256=VPTlKKCEd9FFusce2wVbScIB
72
72
  _balder/objects/devices/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  _balder/objects/devices/this_device.py,sha256=Ah0UNIqgUbtZ_B85fROjKbQS-NTDH1F3gscshB8UBsc,442
74
74
  _balder/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
- _balder/utils/functions.py,sha256=6qpHSSlUz-Xc0t00VPIKJzzJBJrjYi9ii4mTFX-fb_I,4276
75
+ _balder/utils/functions.py,sha256=0GcyDhEh1OCtY6RxOMBvvalTcTC97pgL9Ggg1iMYiiI,4323
76
76
  _balder/utils/inner_device_managing_metaclass.py,sha256=5haJb6XNjhxULFW1Sy8Dp7SO9Hex-yuF0rK1FG0UOXk,570
77
77
  _balder/utils/mixin_can_be_covered_by_executor.py,sha256=yDOsYh9mfhcLUAH0ahuFbdDKYsxaqbPsUEEctC3YenU,718
78
78
  _balder/utils/typings.py,sha256=eh3mw8wRQjTkuitGJKJSKu2JmyOnpWYMI9bAzE9M_KU,118
@@ -81,9 +81,9 @@ balder/connections.py,sha256=H6rf7UsiVY_FeZLngZXCT9WDw9cQqpiDiPbz_0J4yjM,2331
81
81
  balder/devices.py,sha256=zupHtz8yaiEjzR8CrvgZU-RzsDQcZFeN5mObfhtjwSw,173
82
82
  balder/exceptions.py,sha256=iaR4P2L7K3LggYSDnjCGLheZEaGgnMilxDQdoYD5KHQ,1954
83
83
  balder/parametrization.py,sha256=R8U67f6DEnXdDc9cGOgS8yFTEAfhglv1v9mnAUAExUg,150
84
- baldertest-0.1.0b13.dist-info/licenses/LICENSE,sha256=Daz9qTpqbiq-klWb2Q9lYOmn3rJ5oIQnbs62sGcqOZ4,1084
85
- baldertest-0.1.0b13.dist-info/METADATA,sha256=H1qa7Y2O_dxTi1st-H9NpKKmU0bOIgDhJiouXU_dE9g,15806
86
- baldertest-0.1.0b13.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
87
- baldertest-0.1.0b13.dist-info/entry_points.txt,sha256=hzqu_nrMKTCi5IJqzS1fhIXWEiL7mTGZ-kgj2lUYlRU,65
88
- baldertest-0.1.0b13.dist-info/top_level.txt,sha256=RUkIBkNLqHMemx2C9aEpoS65dpqb6_jU-oagIPxGQEA,15
89
- baldertest-0.1.0b13.dist-info/RECORD,,
84
+ baldertest-0.1.0b14.dist-info/licenses/LICENSE,sha256=Daz9qTpqbiq-klWb2Q9lYOmn3rJ5oIQnbs62sGcqOZ4,1084
85
+ baldertest-0.1.0b14.dist-info/METADATA,sha256=4jKylhMf05-alO4ThYvff56kssjzuh6dWMcobpMAUpE,15806
86
+ baldertest-0.1.0b14.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
87
+ baldertest-0.1.0b14.dist-info/entry_points.txt,sha256=hzqu_nrMKTCi5IJqzS1fhIXWEiL7mTGZ-kgj2lUYlRU,65
88
+ baldertest-0.1.0b14.dist-info/top_level.txt,sha256=RUkIBkNLqHMemx2C9aEpoS65dpqb6_jU-oagIPxGQEA,15
89
+ baldertest-0.1.0b14.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (77.0.3)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5