/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_hashcache.py

  • Committer: Robert Collins
  • Date: 2006-03-03 02:09:49 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060303020949-0ddc6f33d0a43943
Smoke test for RevisionStore factories creating revision stores.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from bzrlib.errors import BzrError
23
23
from bzrlib.hashcache import HashCache
24
 
from bzrlib.tests import TestCaseInTempDir, TestSkipped
 
24
from bzrlib.tests import TestCaseInTempDir
25
25
 
26
26
 
27
27
def sha1(t):
99
99
 
100
100
        self.assertEquals(hc.get_sha1('subdir'), None)
101
101
 
102
 
        # pause briefly to make sure they're not treated as new uncacheable
103
 
        # files
 
102
        # it's likely neither are cached at the moment because they 
 
103
        # changed recently, but we can't be sure
104
104
        pause()
105
105
 
 
106
        # should now be safe to cache it if we reread them
106
107
        self.assertEquals(hc.get_sha1('foo'), sha1('g00dbye'))
 
108
        self.assertEquals(len(hc._cache), 1)
107
109
        self.assertEquals(hc.get_sha1('foo2'), sha1('new content'))
 
110
        self.assertEquals(len(hc._cache), 2)
108
111
 
109
112
        # write out, read back in and check that we don't need to
110
113
        # re-read any files
128
131
        ok = False
129
132
 
130
133
        # make a best effort to create a weird kind of file
131
 
        funcs = (getattr(os, 'mkfifo', None), getattr(os, 'mknod', None))
 
134
        funcs = (os.mkfifo, os.mknod)
132
135
        for func in funcs:
133
 
            if func is None:
134
 
                continue
135
136
            try:
136
137
                func('a')
137
138
                ok = True
142
143
        if ok:
143
144
            self.assertRaises(BzrError, hc.get_sha1, 'a')
144
145
        else:
145
 
            raise TestSkipped('No weird file type could be created')
 
146
            raise BzrError("no weird file type could be created: extend this test case for your os")