##// END OF EJS Templates
util: add a doctest for empty sha() calls
Matt Mackall -
r15392:d7bfbc92 stable
parent child Browse files
Show More
@@ -443,7 +443,7 def mkstemp(repo, prefix):
443 '''Returns a file descriptor and a filename corresponding to a temporary
443 '''Returns a file descriptor and a filename corresponding to a temporary
444 file in the repo's largefiles store.'''
444 file in the repo's largefiles store.'''
445 path = repo.join(longname)
445 path = repo.join(longname)
446 util.makedirs(repo.join(path))
446 util.makedirs(path)
447 return tempfile.mkstemp(prefix=prefix, dir=path)
447 return tempfile.mkstemp(prefix=prefix, dir=path)
448
448
449 class storeprotonotcapable(Exception):
449 class storeprotonotcapable(Exception):
@@ -74,6 +74,16 username = platform.username
74 # Python compatibility
74 # Python compatibility
75
75
76 def sha1(s=''):
76 def sha1(s=''):
77 '''
78 Low-overhead wrapper around Python's SHA support
79
80 >>> f = _fastsha1
81 >>> a = sha1()
82 >>> a = f()
83 >>> a.hexdigest()
84 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
85 '''
86
77 return _fastsha1(s)
87 return _fastsha1(s)
78
88
79 _notset = object()
89 _notset = object()
@@ -4,6 +4,9 if 'TERM' in os.environ:
4 del os.environ['TERM']
4 del os.environ['TERM']
5 import doctest
5 import doctest
6
6
7 import mercurial.util
8 doctest.testmod(mercurial.util)
9
7 import mercurial.changelog
10 import mercurial.changelog
8 doctest.testmod(mercurial.changelog)
11 doctest.testmod(mercurial.changelog)
9
12
@@ -22,9 +25,6 doctest.testmod(mercurial.ui)
22 import mercurial.url
25 import mercurial.url
23 doctest.testmod(mercurial.url)
26 doctest.testmod(mercurial.url)
24
27
25 import mercurial.util
26 doctest.testmod(mercurial.util)
27
28 import mercurial.encoding
28 import mercurial.encoding
29 doctest.testmod(mercurial.encoding)
29 doctest.testmod(mercurial.encoding)
30
30
General Comments 0
You need to be logged in to leave comments. Login now