1212import yaml
1313
1414from chaoslib .exceptions import ActivityFailed , InvalidActivity , \
15- InvalidExperiment , InterruptExecution
15+ InvalidExperiment , InterruptExecution , ValidationError
1616from chaoslib .experiment import ensure_experiment_is_valid , load_experiment , \
1717 run_experiment , run_activities
1818from chaoslib .types import Experiment
2121
2222
2323def test_empty_experiment_is_invalid ():
24- with pytest .raises (InvalidExperiment ) as exc :
24+ with pytest .raises (ValidationError ) as exc :
2525 ensure_experiment_is_valid (experiments .EmptyExperiment )
2626 assert "an empty experiment is not an experiment" in str (exc .value )
2727
@@ -65,27 +65,27 @@ def test_unknown_extension():
6565
6666
6767def test_experiment_must_have_a_method ():
68- with pytest .raises (InvalidExperiment ) as exc :
68+ with pytest .raises (ValidationError ) as exc :
6969 ensure_experiment_is_valid (experiments .MissingMethodExperiment )
7070 assert "an experiment requires a method with " \
7171 "at least one activity" in str (exc .value )
7272
7373
7474def test_experiment_must_have_at_least_one_step ():
75- with pytest .raises (InvalidExperiment ) as exc :
75+ with pytest .raises (ValidationError ) as exc :
7676 ensure_experiment_is_valid (experiments .NoStepsMethodExperiment )
7777 assert "an experiment requires a method with " \
7878 "at least one activity" in str (exc .value )
7979
8080
8181def test_experiment_must_have_a_title ():
82- with pytest .raises (InvalidExperiment ) as exc :
82+ with pytest .raises (ValidationError ) as exc :
8383 ensure_experiment_is_valid (experiments .MissingTitleExperiment )
8484 assert "experiment requires a title" in str (exc .value )
8585
8686
8787def test_experiment_must_have_a_description ():
88- with pytest .raises (InvalidExperiment ) as exc :
88+ with pytest .raises (ValidationError ) as exc :
8989 ensure_experiment_is_valid (experiments .MissingDescriptionExperiment )
9090 assert "experiment requires a description" in str (exc .value )
9191
@@ -96,13 +96,13 @@ def test_experiment_may_not_have_a_hypothesis():
9696
9797
9898def test_experiment_hypothesis_must_have_a_title ():
99- with pytest .raises (InvalidExperiment ) as exc :
99+ with pytest .raises (ValidationError ) as exc :
100100 ensure_experiment_is_valid (experiments .MissingHypothesisTitleExperiment )
101101 assert "hypothesis requires a title" in str (exc .value )
102102
103103
104104def test_experiment_hypothesis_must_have_a_valid_probe ():
105- with pytest .raises (InvalidExperiment ) as exc :
105+ with pytest .raises (ValidationError ) as exc :
106106 ensure_experiment_is_valid (experiments .ExperimentWithInvalidHypoProbe )
107107 assert "required argument 'path' is missing from activity" in str (exc .value )
108108
0 commit comments