示例#1
0
 def test_essential_keys_ok_3(self):
     """
     If block starts with "multi_process_count"
     does not require "step" or "class"
     """
     test_yaml = [{"multi_process_count": 1}]
     valid_instance = EssentialKeys(test_yaml)
     valid_instance()
示例#2
0
 def test_essential_keys_ng1(self):
     """
     Block requires both "step" and "class"
     """
     test_yaml = [{"class": "SampleClass"}]
     with pytest.raises(ScenarioFileInvalid) as excinfo:
         valid_instance = EssentialKeys(test_yaml)
         valid_instance()
     assert "scenario.yml is invalid. 'step:' does not exist." in str(
         excinfo.value)
示例#3
0
 def test_essential_keys_ok_1(self):
     """
     Block requires both "step" and "class"
     """
     test_yaml = [{
         "step": "test step",
         "class": "SampleClass",
     }]
     valid_instance = EssentialKeys(test_yaml)
     valid_instance()
示例#4
0
 def test_essential_keys_ok_2(self):
     """
     If block starts with "parallel"
     all steps under the "parallel" requires both "step" and "class"
     """
     test_yaml = [{
         "parallel": [
             {
                 "step": "test step 1",
                 "class": "SampleClass",
             },
             {
                 "step": "test step 2",
                 "class": "SampleClass",
             },
         ]
     }]
     valid_instance = EssentialKeys(test_yaml)
     valid_instance()
示例#5
0
 def test_essential_keys_ng_2(self):
     """
     If block starts with "parallel"
     all steps under the "parallel" requires both "step" and "class"
     """
     test_yaml = [{
         "parallel": [
             {
                 "step": "test step 1",
                 "class": "SampleClass",
             },
             {
                 "class": "SampleClass",
             },
         ]
     }]
     with pytest.raises(ScenarioFileInvalid) as excinfo:
         valid_instance = EssentialKeys(test_yaml)
         valid_instance()
     assert "scenario.yml is invalid. 'step:' does not exist." in str(
         excinfo.value)
示例#6
0
 def __exists_ess_keys(self, scenario_yaml_list):
     """
     Check if the essential keys exist in scenario.yml
     """
     valid = EssentialKeys(scenario_yaml_list)
     valid()