~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: Robert Collins
  • Date: 2006-01-02 22:37:32 UTC
  • mfrom: (1185.50.33 bzr-jam-integration)
  • Revision ID: robertc@robertcollins.net-20060102223732-d5221b37ff0f7888
Merge in John Meinels integration branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from bzrlib.errors import NotBranchError, NotVersionedError
21
21
from bzrlib.tests import TestCaseInTempDir
22
22
from bzrlib.trace import mutter
 
23
from bzrlib.osutils import pathjoin, getcwd, has_symlinks
23
24
from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
24
25
                                WorkingTree)
25
26
 
53
54
        branch = Branch.initialize(u'.')
54
55
        os.mkdir('dir')
55
56
        print >> open('file', 'w'), "content"
56
 
        os.symlink('target', 'symlink')
 
57
        if has_symlinks():
 
58
            os.symlink('target', 'symlink')
57
59
        tree = branch.working_tree()
58
60
        files = list(tree.list_files())
59
61
        self.assertEqual(files[0], ('dir', '?', 'directory', None, TreeDirectory()))
60
62
        self.assertEqual(files[1], ('file', '?', 'file', None, TreeFile()))
61
 
        self.assertEqual(files[2], ('symlink', '?', 'symlink', None, TreeLink()))
 
63
        if has_symlinks():
 
64
            self.assertEqual(files[2], ('symlink', '?', 'symlink', None, TreeLink()))
62
65
 
63
66
    def test_open_containing(self):
64
67
        branch = Branch.initialize(u'.')
74
77
        # paths that are urls are just plain wrong for working trees.
75
78
        self.assertRaises(NotBranchError,
76
79
                          WorkingTree.open_containing, 
77
 
                          'file:///' + os.getcwdu())
 
80
                          'file:///' + getcwd())
78
81
 
79
82
    def test_construct_with_branch(self):
80
83
        branch = Branch.initialize(u'.')
93
96
        branch = Branch.initialize(u'.')
94
97
        tree = WorkingTree(branch.base)
95
98
        self.assertEqual('child',
96
 
                         tree.relpath(os.path.join(os.getcwd(), 'child')))
 
99
                         tree.relpath(pathjoin(getcwd(), 'child')))
97
100
 
98
101
    def test_lock_locks_branch(self):
99
102
        branch = Branch.initialize(u'.')