Пример #1
0
 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")
Пример #2
0
    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))
Пример #3
0
 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")
Пример #4
0
 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))
Пример #5
0
 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)
Пример #6
0
 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)