def test_load_yaml_file_format_error(self):
        yml_tmp_file_path = 'tests/data/tmp.yml'

        #create empty file
        with open(yml_tmp_file_path, 'w') as f:
            f.write('')

        with pytest.raises(exceptions.FileFormatError):
            loader.load_yaml_file(yml_tmp_file_path)

        #os.remove(yml_tmp_file_path)

        # create invaild format yaml file
        with open(yml_tmp_file_path, 'w') as f:
            f.write('abc')

        with pytest.raises(exceptions.FileFormatError):
            loader.load_yaml_file(yml_tmp_file_path)
    def test_run_single_yaml_testcase_success(self):
        path = 'tests/testcase/smoke_test.yml'

        json_testcase = loader.load_yaml_file(path)

        success, diff_content = runner.run_single_testcase(json_testcase)

        print(diff_content)
        assert success
Exemple #3
0
    def test_load_yaml_file_file_format_error(self):
        yaml_tmp_file = "tests/data/tmp.yml"
        # create empty yaml file
        with open(yaml_tmp_file, 'w') as f:
            f.write("")

        with self.assertRaises(exceptions.FileFormatError):
            loader.load_yaml_file(yaml_tmp_file)

        os.remove(yaml_tmp_file)

        # create invalid format yaml file
        with open(yaml_tmp_file, 'w') as f:
            f.write("abc")

        with self.assertRaises(exceptions.FileFormatError):
            loader.load_yaml_file(yaml_tmp_file)

        os.remove(yaml_tmp_file)