Ticket #25542: 25542.diff

File 25542.diff, 1.4 KB (added by Hiroki Kiyohara, 9 years ago)
  • tests/runtests.py

    diff --git a/tests/runtests.py b/tests/runtests.py
    index 955f96d..996ed7c 100755
    a b SUBDIRS_TO_SKIP = [  
    4545    'import_error_package',
    4646    'test_discovery_sample',
    4747    'test_discovery_sample2',
     48    'test_discovery_import_error',
    4849    'test_runner_deprecation_app',
    4950]
    5051
  • new file tests/test_discovery_import_error/tests.py

    diff --git a/tests/test_discovery_import_error/__init__.py b/tests/test_discovery_import_error/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/test_discovery_import_error/tests.py b/tests/test_discovery_import_error/tests.py
    new file mode 100644
    index 0000000..1f3ce16
    - +  
     1import notexistmodule  # Kadoom
  • tests/test_runner/test_discover_runner.py

    diff --git a/tests/test_runner/test_discover_runner.py b/tests/test_runner/test_discover_runner.py
    index dc82c24..083ace0 100644
    a b class DiscoverRunnerTest(TestCase):  
    165165
    166166    def test_overrideable_test_loader(self):
    167167        self.assertEqual(DiscoverRunner().test_loader, defaultTestLoader)
     168
     169    def test_import_error_in_tests_module(self):
     170        with self.assertRaises(ImportError) as cm:
     171            DiscoverRunner().build_suite(
     172                ["test_discovery_sample.tests_discovery_import_error"],
     173            )
     174        self.assertEqual(cm.exception.message, 'No module named notexistmodule')
Back to Top