-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment.py
77 lines (59 loc) · 1.88 KB
/
environment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
######################################
# Imports
######################################
# External
from behave.model import Feature, Scenario
from behave.runner import Context
# Internal
from steps.data_model import BehaviourTestModel
######################################
# Functions
######################################
def before_feature(context: Context, feature: Feature) -> None:
"""
Before feature environmental control.
Args:
context (Context):
The current test context.
feature (Feature):
The current test feature.
"""
context.traces = {}
def after_feature(context: Context, feature: Feature) -> None:
"""
After feature environmental control.
Args:
context (Context):
The current test context.
feature (Feature):
The current test feature.
"""
context.traces = None
def before_scenario(context: Context, scenario: Scenario) -> None:
"""
Before scenario environmental control.
Args:
context (Context):
The current test context.
scenario (Scenario):
The current test scenario.
"""
tags = scenario.tags
fisheries_modelling_tag = "fisheries_modelling"
if fisheries_modelling_tag in tags:
context.behaviour = BehaviourTestModel()
context.model_scores = {}
def after_scenario(context: Context, scenario: Scenario) -> None:
"""
After scenario environmental control.
Args:
context (Context):
The current test context.
scenario (Scenario):
The current test scenario.
"""
tags = scenario.tags
fisheries_modelling_tag = "fisheries_modelling"
if fisheries_modelling_tag in tags:
context.behaviour = None
context.model_scores = None