~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-24 00:08:33 UTC
  • mfrom: (1954 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1979.
  • Revision ID: john@arbash-meinel.com-20060824000833-f32d5cbef4fa4f78
[merge] bzr.dev 1954

Show diffs side-by-side

added added

removed removed

Lines of Context:
576
576
            self.fail("%r is an instance of %s rather than %s" % (
577
577
                obj, obj.__class__, kls))
578
578
 
579
 
    def assertDeprecated(self, expected, callable, *args, **kwargs):
 
579
    def callDeprecated(self, expected, callable, *args, **kwargs):
580
580
        """Assert that a callable is deprecated in a particular way.
581
581
 
582
582
        :param expected: a list of the deprecation warnings expected, in order
591
591
        method = symbol_versioning.warn
592
592
        symbol_versioning.set_warning_method(capture_warnings)
593
593
        try:
594
 
            callable(*args, **kwargs)
 
594
            result = callable(*args, **kwargs)
595
595
        finally:
596
 
            result = symbol_versioning.set_warning_method(method)
 
596
            symbol_versioning.set_warning_method(method)
597
597
        self.assertEqual(expected, local_warnings)
598
598
        return result
599
599
 
603
603
        The file is removed as the test is torn down.
604
604
        """
605
605
        fileno, name = tempfile.mkstemp(suffix='.log', prefix='testbzr')
606
 
        encoder, decoder, stream_reader, stream_writer = codecs.lookup('UTF-8')
607
 
        self._log_file = stream_writer(os.fdopen(fileno, 'w+'))
 
606
        self._log_file = os.fdopen(fileno, 'w+')
608
607
        self._log_nonce = bzrlib.trace.enable_test_log(self._log_file)
609
608
        self._log_file_name = name
610
609
        self.addCleanup(self._finishLogFile)