~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_bzrdir/test_bzrdir.py

  • Committer: Martin Pool
  • Date: 2010-02-25 06:17:27 UTC
  • mfrom: (5055 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5057.
  • Revision ID: mbp@sourcefrog.net-20100225061727-4sd9lt0qmdc6087t
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 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
21
21
from itertools import izip
22
22
import os
23
23
from stat import S_ISDIR
24
 
import sys
25
24
 
26
25
import bzrlib.branch
27
26
from bzrlib import (
1426
1425
        self.failUnless(isinstance(opened_branch, made_branch.__class__))
1427
1426
        self.failUnless(isinstance(opened_branch._format, made_branch._format.__class__))
1428
1427
 
 
1428
    def test_list_branches(self):
 
1429
        if not self.bzrdir_format.is_supported():
 
1430
            # unsupported formats are not loopback testable
 
1431
            # because the default open will not open them and
 
1432
            # they may not be initializable.
 
1433
            return
 
1434
        t = get_transport(self.get_url())
 
1435
        made_control = self.bzrdir_format.initialize(t.base)
 
1436
        made_repo = made_control.create_repository()
 
1437
        made_branch = made_control.create_branch()
 
1438
        branches = made_control.list_branches()
 
1439
        self.assertEquals(1, len(branches))
 
1440
        self.assertEquals(made_branch.base, branches[0].base)
 
1441
        try:
 
1442
            made_control.destroy_branch()
 
1443
        except errors.UnsupportedOperation:
 
1444
            pass # Not all bzrdirs support destroying directories
 
1445
        else:
 
1446
            self.assertEquals([], made_control.list_branches())
 
1447
 
1429
1448
    def test_create_repository(self):
1430
1449
        # a bzrdir can construct a repository for itself.
1431
1450
        if not self.bzrdir_format.is_supported():