/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: Vincent Ladeuil
  • Date: 2010-06-17 16:54:26 UTC
  • mto: This revision was merged to the branch mainline in revision 5306.
  • Revision ID: v.ladeuil+lp@free.fr-20100617165426-741tbmgwi62a9zub
Pass BZR_PLUGINS_AT and BZR_DISABLE_PLINGS to the subprocess fpr test_import_tariff

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
from bzrlib.tests import (
113
113
    test_server,
114
114
    TestUtil,
 
115
    treeshape,
115
116
    )
116
117
from bzrlib.tests.http_server import HttpServer
117
118
from bzrlib.tests.TestUtil import (
118
119
                          TestSuite,
119
120
                          TestLoader,
120
121
                          )
121
 
from bzrlib.tests.treeshape import build_tree_contents
122
122
from bzrlib.ui import NullProgressView
123
123
from bzrlib.ui.text import TextUIFactory
124
124
import bzrlib.version_info_formats.format_custom
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:
1524
1524
            'EDITOR': None,
1525
1525
            'BZR_EMAIL': None,
1526
1526
            'BZREMAIL': None, # may still be present in the environment
1527
 
            'EMAIL': None,
 
1527
            'EMAIL': 'jrandom@example.com', # set EMAIL as bzr does not guess
1528
1528
            'BZR_PROGRESS_BAR': None,
1529
1529
            'BZR_LOG': None,
1530
1530
            'BZR_PLUGIN_PATH': 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)
2578
2582
                content = "contents of %s%s" % (name.encode('utf-8'), end)
2579
2583
                transport.put_bytes_non_atomic(urlutils.escape(name), content)
2580
2584
 
2581
 
    def build_tree_contents(self, shape):
2582
 
        build_tree_contents(shape)
 
2585
    build_tree_contents = staticmethod(treeshape.build_tree_contents)
2583
2586
 
2584
2587
    def assertInWorkingTree(self, path, root_path='.', tree=None):
2585
2588
        """Assert whether path or paths are in the WorkingTree"""
4102
4105
        if test_id != None:
4103
4106
            ui.ui_factory.clear_term()
4104
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')
4105
4111
        sys.stderr.write('Unable to remove testing dir %s\n%s'
4106
 
                         % (os.path.basename(dirname), e))
 
4112
                         % (os.path.basename(dirname), printable_e))
4107
4113
 
4108
4114
 
4109
4115
class Feature(object):
4339
4345
UnicodeFilename = _UnicodeFilename()
4340
4346
 
4341
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
 
4342
4359
class _UTF8Filesystem(Feature):
4343
4360
    """Is the filesystem UTF-8?"""
4344
4361