Пример #1
0
    def test_imported_things_are_ignored(self):
        #TODO CHANGE MY NAME
        discovered_imported = list(test_discovery.discover('test.test_suite_subdir.import_testcase'))
        discovered_actually_defined_in_module = list(test_discovery.discover('test.test_suite_subdir.define_testcase'))

        assert_length(discovered_imported, 0)
        assert_length(discovered_actually_defined_in_module, 1)
Пример #2
0
    def test_discover_test_with_unknown_import_error(self):
        """Insure that DiscoveryError is raised when a test which raises an unusual exception upon import is discovered."""

        try:
            discovered_tests = test_discovery.discover(self.broken_import_module)
            discovered_tests.next()
        except DiscoveryError, exc:
            assert_in('Got unknown error when trying to import', str(exc))
Пример #3
0
 def test_discover_test_with_broken_import(self):
     """Insure that DiscoveryError is raised when a test which imports a
     non-existent module is discovered."""
     try:
         discovered_tests = test_discovery.discover(self.broken_import_module)
         discovered_tests.next()
     except DiscoveryError, exc:
         assert_in('No module named non_existent_module', str(exc))
Пример #4
0
    def test_discover_test_with_unknown_import_error(self):
        """Insure that DiscoveryError is raised when a test which raises an unusual exception upon import is discovered."""

        try:
            discovered_tests = test_discovery.discover(self.broken_import_module)
            next(discovered_tests)
        except DiscoveryError as exc:
            assert_in("Got unknown error when trying to import", str(exc))
        else:
            assert False, "Expected DiscoveryError."
Пример #5
0
 def test_discover_test_with_broken_import(self):
     """Insure that DiscoveryError is raised when a test which imports a
     non-existent module is discovered."""
     try:
         discovered_tests = test_discovery.discover(self.broken_import_module)
         next(discovered_tests)
     except DiscoveryError as exc:
         assert_in("No module named non_existent_module", str(exc))
     else:
         assert False, "Expected DiscoveryError."
Пример #6
0
 def discover(self, path):
     # Exhaust the generator to catch exceptions
     return [mod for mod in test_discovery.discover(path)]
Пример #7
0
 def discover(self, path):
     # Exhaust the generator to catch exceptons
     [mod for mod in test_discovery.discover(path)]