def test_empty_list(self, empty_module_hierarchy): """Test a config where the value is an empty list""" config = ZigZagConfig(empty_module_hierarchy, {}) expected_message = "The config setting 'module_hierarchy' was not found in the config file" with pytest.raises(ZigZagConfigError, match=expected_message): config.get_config('module_hierarchy')
def test_list_value_containing_empty_value(self, module_hierarchy_two_nodes): """Test a config where a list contains an empty string""" properties = {'NODE_ONE': 'FOO'} # do not supply NODE_TWO config = ZigZagConfig(module_hierarchy_two_nodes, properties) expected_message = 'The config module_hierarchy contained an empty value' with pytest.raises(ZigZagConfigError, match=expected_message): config.get_config('module_hierarchy')
def test_access_config_not_present(self, config_with_interpolation): """Test that we will raise error if value defined in config is not present in the global properties""" properties = {} config = ZigZagConfig(config_with_interpolation, properties) expected_message = "The config setting 'path_to_test_exec_dir' was not found in the config file" with pytest.raises(ZigZagConfigError, match=expected_message): config.get_config('path_to_test_exec_dir')
def test_zz_testcase_class_variable(self, config_with_zz_variable, mocker): """Test that we can use the 'zz_testcase_class' special variable in a ZigZag config""" # Mock zz_test_log = mocker.MagicMock() zz_test_log.classname = 'this.is.the.classname' properties = {} config = ZigZagConfig(config_with_zz_variable, properties) assert ['one', 'two', zz_test_log.classname ] == config.get_config('module_hierarchy', zz_test_log)
def test_pull_value_from_properties(self, config_with_interpolation): """Test that we can interpolate one value successfully""" properties = {'FOO': '/Hello/is/it/me/youre/looking/for'} config = ZigZagConfig(config_with_interpolation, properties) assert properties['FOO'] == config.get_config('path_to_test_exec_dir')