/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Robert Collins
  • Date: 2010-06-21 01:30:45 UTC
  • mfrom: (5309 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5310.
  • Revision ID: robertc@robertcollins.net-20100621013045-s59nfjps3rkcn53j
Merge trunk to fix NEWS sections.

Show diffs side-by-side

added added

removed removed

Lines of Context:
749
749
    # XXX: Should probably unify more with CannedInputUIFactory or a
750
750
    # particular configuration of TextUIFactory, or otherwise have a clearer
751
751
    # idea of how they're supposed to be different.
752
 
    # See https://bugs.edge.launchpad.net/bzr/+bug/408213
 
752
    # See https://bugs.launchpad.net/bzr/+bug/408213
753
753
 
754
754
    def __init__(self, stdout=None, stderr=None, stdin=None):
755
755
        if stdin is not None:
2482
2482
 
2483
2483
    def check_file_contents(self, filename, expect):
2484
2484
        self.log("check contents of file %s" % filename)
2485
 
        contents = file(filename, 'r').read()
 
2485
        f = file(filename)
 
2486
        try:
 
2487
            contents = f.read()
 
2488
        finally:
 
2489
            f.close()
2486
2490
        if contents != expect:
2487
2491
            self.log("expected: %r" % expect)
2488
2492
            self.log("actually: %r" % contents)
3733
3737
        'bzrlib.tests.test_lru_cache',
3734
3738
        'bzrlib.tests.test_lsprof',
3735
3739
        'bzrlib.tests.test_mail_client',
 
3740
        'bzrlib.tests.test_matchers',
3736
3741
        'bzrlib.tests.test_memorytree',
3737
3742
        'bzrlib.tests.test_merge',
3738
3743
        'bzrlib.tests.test_merge3',
4100
4105
        if test_id != None:
4101
4106
            ui.ui_factory.clear_term()
4102
4107
            sys.stderr.write('\nWhile running: %s\n' % (test_id,))
 
4108
        # Ugly, but the last thing we want here is fail, so bear with it.
 
4109
        printable_e = str(e).decode(osutils.get_user_encoding(), 'replace'
 
4110
                                    ).encode('ascii', 'replace')
4103
4111
        sys.stderr.write('Unable to remove testing dir %s\n%s'
4104
 
                         % (os.path.basename(dirname), e))
 
4112
                         % (os.path.basename(dirname), printable_e))
4105
4113
 
4106
4114
 
4107
4115
class Feature(object):
4337
4345
UnicodeFilename = _UnicodeFilename()
4338
4346
 
4339
4347
 
 
4348
class _ByteStringNamedFilesystem(Feature):
 
4349
    """Is the filesystem based on bytes?"""
 
4350
 
 
4351
    def _probe(self):
 
4352
        if os.name == "posix":
 
4353
            return True
 
4354
        return False
 
4355
 
 
4356
ByteStringNamedFilesystem = _ByteStringNamedFilesystem()
 
4357
 
 
4358
 
4340
4359
class _UTF8Filesystem(Feature):
4341
4360
    """Is the filesystem UTF-8?"""
4342
4361