[rfc] [patch] small cleanups
Martin Pool
mbp at sourcefrog.net
Fri Jan 13 08:12:37 GMT 2006
On 12 Jan 2006, Denys Duchier <duchier at ps.uni-sb.de> wrote:
> Martin Pool <martinpool at gmail.com> writes:
>
> > On 12/01/06, Denys Duchier <duchier at ps.uni-sb.de> wrote:
> >> Robert Collins <robertc at robertcollins.net> writes:
> >>
> >> > 'ok=True' should be 'ok = True' (PEP8).
> >>
> >> done: revno=1500 in branch bzr.tests
> >
> > Thanks, merged in.
>
> er... I don't see test_hashcache_raise in bzr.dev. Please merge from my
> bzr.patches branch (this is where I transfert all my +2ed patches).
I've just merged it in, which made the change to bzr.dev shown below.
Thanks,
--
Martin
-------------- next part --------------
=== modified file 'bzrlib/tests/test_hashcache.py'
--- bzrlib/tests/test_hashcache.py
+++ bzrlib/tests/test_hashcache.py
@@ -36,6 +36,10 @@
start = int(time.time())
while int(time.time()) == start:
time.sleep(0.2)
+
+
+class FixThisError(Exception):
+ pass
class TestHashCache(TestCaseInTempDir):
@@ -118,3 +122,28 @@
self.assertEquals(hc.hit_count, 1)
self.assertEquals(hc.miss_count, 0)
self.assertEquals(hc.get_sha1('foo2'), sha1('new content'))
+
+ def test_hashcache_raise(self):
+ """check that hashcache can raise BzrError"""
+ from bzrlib.hashcache import HashCache
+ import os
+
+ os.mkdir('.bzr')
+ hc = HashCache(u'.')
+ ok = False
+
+ # make a best effort to create a weird kind of file
+ funcs = (os.mkfifo, os.mknod)
+ for func in funcs:
+ try:
+ func('a')
+ ok = True
+ break
+ except FixThisError:
+ pass
+
+ from bzrlib.errors import BzrError
+ if ok:
+ self.assertRaises(BzrError, hc.get_sha1, 'a')
+ else:
+ raise BzrError("no weird file type could be created: extend this test case for your os")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060113/7d2d6d38/attachment.pgp
More information about the bazaar
mailing list