~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testhashcache.py

  • Committer: Robert Collins
  • Date: 2005-08-25 01:13:32 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050825011331-6d549d5de7edcec1
two bugfixes to smart_add - do not add paths from nested trees to the parent tree, and do not mutate the user supplied file list

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import os
18
 
import sys
19
 
import time
20
 
from bzrlib.tests import TestCaseInTempDir
 
17
from bzrlib.selftest import InTempDir
21
18
 
22
19
 
23
20
 
27
24
 
28
25
 
29
26
def pause():
30
 
    if False:
31
 
        return
32
 
    if sys.platform in ('win32', 'cygwin'):
33
 
        time.sleep(3)
34
 
        return
 
27
    import time
35
28
    # allow it to stabilize
36
29
    start = int(time.time())
37
30
    while int(time.time()) == start:
38
31
        time.sleep(0.2)
39
32
    
40
33
 
41
 
class TestHashCache(TestCaseInTempDir):
 
34
class TestHashCache(InTempDir):
42
35
 
43
36
    def test_hashcache(self):
44
37
        """Functional tests for hashcache"""
45
38
        from bzrlib.hashcache import HashCache
46
39
        import os
 
40
        import time
47
41
 
48
42
        # make a dummy bzr directory just to hold the cache
49
43
        os.mkdir('.bzr')
50
 
        hc = HashCache(u'.')
 
44
        hc = HashCache('.')
51
45
 
52
46
        file('foo', 'wb').write('hello')
53
47
        os.mkdir('subdir')
110
104
        hc.write()
111
105
        del hc
112
106
 
113
 
        hc = HashCache(u'.')
 
107
        hc = HashCache('.')
114
108
        hc.read()
115
109
 
116
110
        self.assertEquals(len(hc._cache), 2)