baldertest 0.1.0b9__py3-none-any.whl → 0.1.0b10__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 (36) hide show
  1. _balder/_version.py +1 -1
  2. _balder/balder_session.py +4 -2
  3. _balder/collector.py +115 -7
  4. _balder/console/balder.py +1 -1
  5. _balder/controllers/device_controller.py +1 -1
  6. _balder/controllers/normal_scenario_setup_controller.py +2 -2
  7. _balder/controllers/scenario_controller.py +91 -1
  8. _balder/decorator_fixture.py +4 -7
  9. _balder/decorator_for_vdevice.py +4 -6
  10. _balder/decorator_parametrize.py +31 -0
  11. _balder/decorator_parametrize_by_feature.py +36 -0
  12. _balder/exceptions.py +6 -0
  13. _balder/executor/basic_executable_executor.py +126 -0
  14. _balder/executor/basic_executor.py +1 -78
  15. _balder/executor/executor_tree.py +7 -5
  16. _balder/executor/parametrized_testcase_executor.py +52 -0
  17. _balder/executor/scenario_executor.py +5 -2
  18. _balder/executor/setup_executor.py +5 -2
  19. _balder/executor/testcase_executor.py +42 -9
  20. _balder/executor/unresolved_parametrized_testcase_executor.py +209 -0
  21. _balder/executor/variation_executor.py +26 -8
  22. _balder/fixture_definition_scope.py +19 -0
  23. _balder/fixture_execution_level.py +22 -0
  24. _balder/fixture_manager.py +169 -182
  25. _balder/fixture_metadata.py +26 -0
  26. _balder/parametrization.py +75 -0
  27. _balder/solver.py +51 -31
  28. balder/__init__.py +6 -0
  29. balder/exceptions.py +4 -3
  30. balder/parametrization.py +8 -0
  31. {baldertest-0.1.0b9.dist-info → baldertest-0.1.0b10.dist-info}/METADATA +1 -1
  32. {baldertest-0.1.0b9.dist-info → baldertest-0.1.0b10.dist-info}/RECORD +36 -26
  33. {baldertest-0.1.0b9.dist-info → baldertest-0.1.0b10.dist-info}/WHEEL +1 -1
  34. {baldertest-0.1.0b9.dist-info → baldertest-0.1.0b10.dist-info}/LICENSE +0 -0
  35. {baldertest-0.1.0b9.dist-info → baldertest-0.1.0b10.dist-info}/entry_points.txt +0 -0
  36. {baldertest-0.1.0b9.dist-info → baldertest-0.1.0b10.dist-info}/top_level.txt +0 -0
@@ -5,9 +5,11 @@ import inspect
5
5
  import logging
6
6
  from _balder.device import Device
7
7
  from _balder.connection import Connection
8
+ from _balder.fixture_execution_level import FixtureExecutionLevel
8
9
  from _balder.testresult import ResultState, BranchBodyResult, ResultSummary
9
- from _balder.executor.basic_executor import BasicExecutor
10
+ from _balder.executor.basic_executable_executor import BasicExecutableExecutor
10
11
  from _balder.executor.testcase_executor import TestcaseExecutor
12
+ from _balder.executor.unresolved_parametrized_testcase_executor import UnresolvedParametrizedTestcaseExecutor
11
13
  from _balder.previous_executor_mark import PreviousExecutorMark
12
14
  from _balder.routing_path import RoutingPath
13
15
  from _balder.unmapped_vdevice import UnmappedVDevice
@@ -26,10 +28,11 @@ if TYPE_CHECKING:
26
28
  logger = logging.getLogger(__file__)
27
29
 
28
30
 
29
- class VariationExecutor(BasicExecutor):
31
+ class VariationExecutor(BasicExecutableExecutor):
30
32
  """
31
33
  A VariationExecutor only contains :meth:`TestcaseExecutor` children.
32
34
  """
35
+ fixture_execution_level = FixtureExecutionLevel.VARIATION
33
36
 
34
37
  def __init__(self, device_mapping: Dict[Type[Device], Type[Device]], parent: ScenarioExecutor):
35
38
  super().__init__()
@@ -107,7 +110,7 @@ class VariationExecutor(BasicExecutor):
107
110
  return self._base_device_mapping
108
111
 
109
112
  @property
110
- def all_child_executors(self) -> List[TestcaseExecutor]:
113
+ def all_child_executors(self) -> List[TestcaseExecutor | UnresolvedParametrizedTestcaseExecutor]:
111
114
  return self._testcase_executors
112
115
 
113
116
  @property
@@ -153,6 +156,7 @@ class VariationExecutor(BasicExecutor):
153
156
  self.exchange_unmapped_vdevice_references()
154
157
  self.update_vdevice_referenced_feature_instances()
155
158
  self.set_conn_dependent_methods()
159
+ self.resolve_possible_parametrization()
156
160
 
157
161
  def _body_execution(self, show_discarded):
158
162
  if show_discarded and not self.can_be_applied():
@@ -289,14 +293,22 @@ class VariationExecutor(BasicExecutor):
289
293
 
290
294
  def get_testcase_executors(self) -> List[TestcaseExecutor]:
291
295
  """returns all sub testcase executors that belongs to this variation-executor"""
292
- return self._testcase_executors
296
+ result = []
297
+ for cur_executor in self._testcase_executors:
298
+ if (isinstance(cur_executor, UnresolvedParametrizedTestcaseExecutor) and
299
+ cur_executor.parametrization_has_been_resolved):
300
+ result += cur_executor.get_testcase_executors()
301
+ else:
302
+ result.append(cur_executor)
303
+ return result
293
304
 
294
- def add_testcase_executor(self, testcase_executor: TestcaseExecutor):
305
+ def add_testcase_executor(self, testcase_executor: TestcaseExecutor | UnresolvedParametrizedTestcaseExecutor):
295
306
  """
296
307
  This method adds a new TestcaseExecutor to the child element list of this object branch
297
308
  """
298
- if not isinstance(testcase_executor, TestcaseExecutor):
299
- raise TypeError("the given object `testcase_executor` must be of type type `TestcaseExecutor`")
309
+ if not isinstance(testcase_executor, (TestcaseExecutor, UnresolvedParametrizedTestcaseExecutor)):
310
+ raise TypeError("the given object `testcase_executor` must be of type type `TestcaseExecutor` or "
311
+ "`UnresolvedParametrizedTestcaseExecutor`")
300
312
  if testcase_executor in self._testcase_executors:
301
313
  raise ValueError("the given object `testcase_executor` already exists in child list")
302
314
  self._testcase_executors.append(testcase_executor)
@@ -461,7 +473,7 @@ class VariationExecutor(BasicExecutor):
461
473
  raise KeyError("the requested setup device exists more than one time in `base_device_mapping`")
462
474
  return [cur_key for cur_key, cur_value in self.base_device_mapping.items() if cur_value == setup_device][0]
463
475
 
464
- def get_executor_for_testcase(self, testcase: callable) -> Union[TestcaseExecutor, None]:
476
+ def get_executor_for_testcase(self, testcase: callable) -> TestcaseExecutor | None:
465
477
  """
466
478
  This method searches for a TestcaseExecutor in the internal list for which the given testcase method is
467
479
  contained in
@@ -876,3 +888,9 @@ class VariationExecutor(BasicExecutor):
876
888
  (mapped_vdevice, absolute_feature_method_var_cnn, cur_method_variation)
877
889
 
878
890
  cur_setup_feature_controller.set_active_method_variation(method_selection=method_var_selection)
891
+
892
+ def resolve_possible_parametrization(self):
893
+ """resolves the parametrization if there are any :class:`UnresolvedParametrizedTestcaseExecutor` in the tree"""
894
+ for cur_child in self._testcase_executors:
895
+ if isinstance(cur_child, UnresolvedParametrizedTestcaseExecutor):
896
+ cur_child.resolve_dynamic_parametrization()
@@ -0,0 +1,19 @@
1
+ from __future__ import annotations
2
+ from typing import List
3
+ from enum import Enum
4
+
5
+
6
+ class FixtureDefinitionScope(Enum):
7
+ """
8
+ This enum describes the definition scope of a fixture. A definition scope is the position the fixture was defined.
9
+ If the fixture was defined within the balderglob.py file, it has the definition-scope `GLOB`. If it is defined
10
+ within a scenario or setup it has the equivalent SCENARIO or SETUP scope.
11
+ """
12
+ GLOB = 'glob'
13
+ SETUP = 'setup'
14
+ SCENARIO = 'scenario'
15
+
16
+ @classmethod
17
+ def get_order(cls) -> List[FixtureDefinitionScope]:
18
+ """returns the priority order of the fixture definition scope"""
19
+ return [cls.GLOB, cls.SETUP, cls.SCENARIO]
@@ -0,0 +1,22 @@
1
+ from __future__ import annotations
2
+ from typing import List
3
+ from enum import Enum
4
+
5
+
6
+ class FixtureExecutionLevel(Enum):
7
+ """
8
+ This enum describes the fixture-execution-level of a fixture. It describes when the fixture should be executed. This
9
+ level will be set in the fixture decorator.
10
+ """
11
+ SESSION = 'session'
12
+ SETUP = 'setup'
13
+ SCENARIO = 'scenario'
14
+ VARIATION = 'variation'
15
+ TESTCASE = 'testcase'
16
+
17
+ @classmethod
18
+ def get_order(cls) -> List[FixtureExecutionLevel]:
19
+ """
20
+ returns the execution order of fixtures
21
+ """
22
+ return [cls.SESSION, cls.SETUP, cls.SCENARIO, cls.VARIATION, cls.TESTCASE]