def test_error_is_raised_if_config_file_does_not_exist(self): non_existent_configuration_file = r"c:\this\file\does\not-exist.yaml" c = Configuration(non_existent_configuration_file) try: # this should raise an error because the config file does not exist c._Configuration__get_configuration_filename() # should not reach here self.fail("An exception was not raised") except FileNotFoundError as e: # expected to reach here self.assertEqual( str(e), "This configuration file does not exist: '{}'".format( non_existent_configuration_file)) pass except: self.fail("The wrong exception was raised")
def test_error_is_not_raised_if_config_file_does_exist(self): c = Configuration( r"Test Configuration Files\test_configuration_file_absolute_path.yaml" ) self.assertIn(r'test_configuration_file_absolute_path.yaml', c._Configuration__get_configuration_filename())