Skip to content

hook_helper

HookHelper

Doc String for Hook Helper.

Source code in libs\cafex_core\src\cafex_core\utils\hooks_\hook_helper.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
class HookHelper:
    """Doc String for Hook Helper."""

    def __init__(self, conf_cwd):
        """Constructor for HookHelper class."""
        self.conf_cwd = conf_cwd
        self.hook_util = HookUtil()
        self.session_store = SessionStore()
        self.execution_uuid = self.hook_util.get_or_create_execution_uuid()
        self.session_store.conf_dir = self.conf_cwd
        self.session_store.execution_uuid = self.execution_uuid
        self._init_hook()

    def _init_hook(self):
        if self.hook_util.is_master_process():
            self.hook_util.create_folders(self.conf_cwd)
            self.hook_util.folder_handler.reorganize_result_folders(
                self.conf_cwd, self.execution_uuid
            )
        self.hook_util.set_paths_from_env()

    @staticmethod
    def pytest_add_option_(parser_):
        PytestAddOptionHook(parser_).add_option_hook()

    @staticmethod
    def pytest_configure_(config):
        PytestConfiguration(config).configure_hook()

    @staticmethod
    def pytest_collection_finish_(session):
        PytestCollectionFinish(session).collection_finish_hook()

    @staticmethod
    def pytest_session_start_(session, sys_arg):
        PytestSessionStart(session, sys_arg).session_start_hook()

    @staticmethod
    def pytest_before_scenario_(feature, scenario_, request, args):
        PytestBeforeScenario(feature, scenario_, request, args).before_scenario_hook()

    @staticmethod
    def pytest_before_step(scenario_, step_):
        PytestBddBeforeStep(scenario_, step_).before_step_hook()

    @staticmethod
    def pytest_after_step(step_):
        PytestBddAfterStep(step_).after_step_hook()

    @staticmethod
    def pytest_after_scenario(scenario, sys_args, feature):
        PytestAfterScenario(scenario, sys_args, feature).after_scenario_hook()

    @staticmethod
    def pytest_run_test_setup(item_):
        PytestRunTestSetup(item_).run_setup()

    @staticmethod
    def pytest_run_test_make_report(report_):
        PytestRunTestMakeReport(report_).run_make_report()

    @staticmethod
    def pytest_run_test_log_report(report):
        PytestRunLogReport(report).run_log_report()

    @staticmethod
    def pytest_bdd_step_error(step):
        PytestBDDStepError(step).bdd_step_error()

    @staticmethod
    def pytest_session_finish_(session):
        PytestSessionFinish(session).session_finish_()

__init__(conf_cwd)

Constructor for HookHelper class.

Source code in libs\cafex_core\src\cafex_core\utils\hooks_\hook_helper.py
22
23
24
25
26
27
28
29
30
def __init__(self, conf_cwd):
    """Constructor for HookHelper class."""
    self.conf_cwd = conf_cwd
    self.hook_util = HookUtil()
    self.session_store = SessionStore()
    self.execution_uuid = self.hook_util.get_or_create_execution_uuid()
    self.session_store.conf_dir = self.conf_cwd
    self.session_store.execution_uuid = self.execution_uuid
    self._init_hook()