~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_info.py

(gz) Backslash escape selftest output when printing to non-unicode consoles
 (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
25
25
    errors,
26
26
    info,
27
27
    osutils,
 
28
    tests,
28
29
    upgrade,
29
30
    urlutils,
30
31
    )
31
 
from bzrlib.osutils import format_date
32
 
from bzrlib.tests import TestSkipped, MemoryServer
33
 
from bzrlib.tests.blackbox import ExternalBase
34
 
 
35
 
 
36
 
class TestInfo(ExternalBase):
 
32
from bzrlib.transport import memory
 
33
 
 
34
 
 
35
class TestInfo(tests.TestCaseWithTransport):
37
36
 
38
37
    def setUp(self):
39
 
        ExternalBase.setUp(self)
 
38
        super(TestInfo, self).setUp()
40
39
        self._repo_strings = "2a"
41
40
 
42
41
    def test_info_non_existing(self):
43
 
        self.vfs_transport_factory = MemoryServer
 
42
        self.vfs_transport_factory = memory.MemoryServer
44
43
        location = self.get_url()
45
44
        out, err = self.run_bzr('info '+location, retcode=3)
46
45
        self.assertEqual(out, '')
127
126
        self.assertEqual('', err)
128
127
        tree1.commit('commit one')
129
128
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
130
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
129
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
131
130
 
132
131
        # Branch standalone with push location
133
132
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
213
212
         0 added
214
213
         0 removed
215
214
         0 renamed
216
 
         1 unknown
217
 
         0 ignored
 
215
         0 unknown
 
216
         1 ignored
218
217
         0 versioned subdirectories
219
218
 
220
219
Branch history:
315
314
        tree1.add('b')
316
315
        tree1.commit('commit two')
317
316
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
318
 
        datestring_last = format_date(rev.timestamp, rev.timezone)
 
317
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
319
318
 
320
319
        # Out of date branched standalone branch will not be detected
321
320
        out, err = self.run_bzr('info -v branch')
381
380
         0 added
382
381
         0 removed
383
382
         0 renamed
384
 
         1 unknown
385
 
         0 ignored
 
383
         0 unknown
 
384
         1 ignored
386
385
         0 versioned subdirectories
387
386
 
388
387
Branch history:
569
568
        tree2.add('a')
570
569
        tree2.commit('commit one')
571
570
        rev = repo.get_revision(branch2.revision_history()[0])
572
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
571
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
573
572
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
574
573
        self.assertEqualDiff(
575
574
"""Lightweight checkout (format: %s)
688
687
 
689
688
        # Out of date lightweight checkout
690
689
        rev = repo.get_revision(branch1.revision_history()[-1])
691
 
        datestring_last = format_date(rev.timestamp, rev.timezone)
 
690
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
692
691
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
693
692
        self.assertEqualDiff(
694
693
"""Lightweight checkout (format: %s)
844
843
        tree1.add('a')
845
844
        tree1.commit('commit one')
846
845
        rev = repo.get_revision(branch1.revision_history()[0])
847
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
846
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
848
847
        out, err = self.run_bzr('info -v repo/branch1')
849
848
        self.assertEqualDiff(
850
849
"""Repository tree (format: knit)
1229
1228
        # Do a light checkout of the heavy one
1230
1229
        transport.mkdir('tree/lightcheckout')
1231
1230
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1232
 
        branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
 
1231
        branch.BranchReferenceFormat().initialize(lco_dir,
 
1232
            target_branch=co_branch)
1233
1233
        lco_dir.create_workingtree()
1234
1234
        lco_tree = lco_dir.open_workingtree()
1235
1235
 
1325
1325
 
1326
1326
    def test_info_locking_oslocks(self):
1327
1327
        if sys.platform == "win32":
1328
 
            raise TestSkipped("don't use oslocks on win32 in unix manner")
 
1328
            self.skip("don't use oslocks on win32 in unix manner")
1329
1329
        # This test tests old (all-in-one, OS lock using) behaviour which
1330
1330
        # simply cannot work on windows (and is indeed why we changed our
1331
1331
        # design. As such, don't try to remove the thisFailsStrictLockCheck