def test_run_transformation_exception(self): # Test another exception occurring during import. entries, errors, options_map = parser.parse_string( 'plugin "failing"\n\n' + TEST_INPUT) loader.run_transformations(entries, errors, options_map, None) trans_entries, trans_errors = loader.run_transformations( entries, errors, options_map, None) self.assertEqual(1, len(trans_errors)) self.assertRegex(trans_errors[0].message, "ValueError")
def test_run_transformations(self): # Test success case. entries, errors, options_map = parser.parse_string(TEST_INPUT) trans_entries, trans_errors = loader.run_transformations( entries, errors, options_map, None) self.assertEqual(0, len(trans_errors)) # Test an invalid plugin name. entries, errors, options_map = parser.parse_string( 'plugin "invalid.module.name"\n\n' + TEST_INPUT) trans_entries, trans_errors = loader.run_transformations( entries, errors, options_map, None) self.assertEqual(1, len(trans_errors))
def test_import_exception(self): # Test an invalid plugin name. entries, errors, options_map = parser.parse_string( 'plugin "invalid.module.name"\n\n' + TEST_INPUT) trans_entries, trans_errors = loader.run_transformations( entries, errors, options_map, None) self.assertEqual(1, len(trans_errors)) self.assertRegex(trans_errors[0].message, "ModuleNotFoundError")
def test_run_transformations(self): # Test success case. entries, errors, options_map = parser.parse_string(TEST_INPUT) trans_entries, trans_errors = loader.run_transformations( entries, errors, options_map, None) self.assertEqual(0, len(trans_errors))
def test_run_transformation_systemexit(self): # Test another exception occurring during import. entries, errors, options_map = parser.parse_string( 'plugin "failing"\n\n' + TEST_INPUT) with self.assertRaises(SystemExit): loader.run_transformations(entries, errors, options_map, None)
def test_import_other_exception(self, _): # Test another exception occurring during import. entries, errors, options_map = parser.parse_string( 'plugin "doesnt_matter"\n\n' + TEST_INPUT) with self.assertRaises(ValueError): loader.run_transformations(entries, errors, options_map, None)