~mordred/testtools/add-file-to-upcall-errors

« back to all changes in this revision

Viewing changes to testtools/testcase.py

  • Committer: Monty Taylor
  • Date: 2013-02-07 09:28:25 UTC
  • Revision ID: mordred@inaugust.com-20130207092825-5a1vt652bymn2a96
Report filenames in upcall errors.

Match other errors, which report filenames due to having exceptions
associated with them. Since these errors don't stem from exceptions,
it's harder to directly follow where the problem came from.

Show diffs side-by-side

added added

removed removed

Lines of Context:
531
531
        ret = self.setUp()
532
532
        if not self.__setup_called:
533
533
            raise ValueError(
 
534
                "In File: %s\n"
534
535
                "TestCase.setUp was not called. Have you upcalled all the "
535
536
                "way up the hierarchy from your setUp? e.g. Call "
536
537
                "super(%s, self).setUp() from your setUp()."
537
 
                % self.__class__.__name__)
 
538
                % (self.__class__.__file__, self.__class__.__name__))
538
539
        return ret
539
540
 
540
541
    def _run_teardown(self, result):
547
548
        ret = self.tearDown()
548
549
        if not self.__teardown_called:
549
550
            raise ValueError(
 
551
                "In File: %s\n"
550
552
                "TestCase.tearDown was not called. Have you upcalled all the "
551
553
                "way up the hierarchy from your tearDown? e.g. Call "
552
554
                "super(%s, self).tearDown() from your tearDown()."
553
 
                % self.__class__.__name__)
 
555
                % (self.__class__.__file__, self.__class__.__name__))
554
556
        return ret
555
557
 
556
558
    def _get_test_method(self):