~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-29 02:31:34 UTC
  • Revision ID: mbp@sourcefrog.net-20050329023134-2d1eb96c55831937
check size and sha1 of files retrieved from the tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
These are run by ``bzr.doctest``.
29
29
 
30
30
>>> import bzrlib, os
 
31
>>> from bzrlib import ScratchBranch
31
32
>>> bzrlib.commands.cmd_rocks()
32
33
it sure does!
33
34
 
139
140
Tests for adding subdirectories, etc.
140
141
 
141
142
    >>> b = bzrlib.branch.ScratchBranch()
142
 
    >>> os.mkdir(b._rel('d1'))
143
 
    >>> os.mkdir(b._rel('d2'))
144
 
    >>> os.mkdir(b._rel('d2/d3'))
 
143
    >>> os.mkdir(b.abspath('d1'))
 
144
    >>> os.mkdir(b.abspath('d2'))
 
145
    >>> os.mkdir(b.abspath('d2/d3'))
145
146
    >>> list(b.working_tree().unknowns())
146
147
    ['d1', 'd2']
147
148
 
148
149
Create some files, but they're not seen as unknown yet:
149
150
 
150
 
    >>> file(b._rel('d1/f1'), 'w').close()
151
 
    >>> file(b._rel('d2/f2'), 'w').close()
152
 
    >>> file(b._rel('d2/f3'), 'w').close()
 
151
    >>> file(b.abspath('d1/f1'), 'w').close()
 
152
    >>> file(b.abspath('d2/f2'), 'w').close()
 
153
    >>> file(b.abspath('d2/f3'), 'w').close()
153
154
    >>> [v[0] for v in b.inventory.directories()]
154
155
    ['']
155
156
    >>> list(b.working_tree().unknowns())
169
170
    >>> list(b.working_tree().unknowns())
170
171
    ['d1/f1', 'd2/d3', 'd2/f2', 'd2/f3']
171
172
 
 
173
    >>> b.add('d1/f1')
 
174
    >>> list(b.working_tree().unknowns())
 
175
    ['d2/d3', 'd2/f2', 'd2/f3']
 
176
 
 
177
Tests for ignored files and patterns:
 
178
 
 
179
    >>> b = ScratchBranch(dirs=['src', 'doc'],
 
180
    ...                   files=['configure.in', 'configure',
 
181
    ...                          'doc/configure', 'foo.c',
 
182
    ...                          'foo'])
 
183
    >>> list(b.unknowns())
 
184
    ['configure', 'configure.in', 'doc', 'foo', 'foo.c', 'src']
 
185
    >>> b.add(['doc', 'foo.c', 'src', 'configure.in'])
 
186
    >>> list(b.unknowns())
 
187
    ['configure', 'doc/configure', 'foo']
 
188
    >>> f = file(b.abspath('.bzrignore'), 'w')
 
189
    >>> f.write('./configure\n'
 
190
    ...         './foo\n')
 
191
    >>> f.close()
 
192
    >>> b.add('.bzrignore')
 
193
    >>> list(b.unknowns())
 
194
    ['configure', 'doc/configure', 'foo']
172
195
"""