12
12
import yaml
13
13
14
14
from chaoslib .exceptions import ActivityFailed , InvalidActivity , \
15
- InvalidExperiment , InterruptExecution
15
+ InvalidExperiment , InterruptExecution , ValidationError
16
16
from chaoslib .experiment import ensure_experiment_is_valid , load_experiment , \
17
17
run_experiment , run_activities
18
18
from chaoslib .types import Experiment
21
21
22
22
23
23
def test_empty_experiment_is_invalid ():
24
- with pytest .raises (InvalidExperiment ) as exc :
24
+ with pytest .raises (ValidationError ) as exc :
25
25
ensure_experiment_is_valid (experiments .EmptyExperiment )
26
26
assert "an empty experiment is not an experiment" in str (exc .value )
27
27
@@ -65,27 +65,27 @@ def test_unknown_extension():
65
65
66
66
67
67
def test_experiment_must_have_a_method ():
68
- with pytest .raises (InvalidExperiment ) as exc :
68
+ with pytest .raises (ValidationError ) as exc :
69
69
ensure_experiment_is_valid (experiments .MissingMethodExperiment )
70
70
assert "an experiment requires a method with " \
71
71
"at least one activity" in str (exc .value )
72
72
73
73
74
74
def test_experiment_must_have_at_least_one_step ():
75
- with pytest .raises (InvalidExperiment ) as exc :
75
+ with pytest .raises (ValidationError ) as exc :
76
76
ensure_experiment_is_valid (experiments .NoStepsMethodExperiment )
77
77
assert "an experiment requires a method with " \
78
78
"at least one activity" in str (exc .value )
79
79
80
80
81
81
def test_experiment_must_have_a_title ():
82
- with pytest .raises (InvalidExperiment ) as exc :
82
+ with pytest .raises (ValidationError ) as exc :
83
83
ensure_experiment_is_valid (experiments .MissingTitleExperiment )
84
84
assert "experiment requires a title" in str (exc .value )
85
85
86
86
87
87
def test_experiment_must_have_a_description ():
88
- with pytest .raises (InvalidExperiment ) as exc :
88
+ with pytest .raises (ValidationError ) as exc :
89
89
ensure_experiment_is_valid (experiments .MissingDescriptionExperiment )
90
90
assert "experiment requires a description" in str (exc .value )
91
91
@@ -96,13 +96,13 @@ def test_experiment_may_not_have_a_hypothesis():
96
96
97
97
98
98
def test_experiment_hypothesis_must_have_a_title ():
99
- with pytest .raises (InvalidExperiment ) as exc :
99
+ with pytest .raises (ValidationError ) as exc :
100
100
ensure_experiment_is_valid (experiments .MissingHypothesisTitleExperiment )
101
101
assert "hypothesis requires a title" in str (exc .value )
102
102
103
103
104
104
def test_experiment_hypothesis_must_have_a_valid_probe ():
105
- with pytest .raises (InvalidExperiment ) as exc :
105
+ with pytest .raises (ValidationError ) as exc :
106
106
ensure_experiment_is_valid (experiments .ExperimentWithInvalidHypoProbe )
107
107
assert "required argument 'path' is missing from activity" in str (exc .value )
108
108
0 commit comments