##// END OF EJS Templates
tests: make test-lrucachedict use absolute_import
Pulkit Goyal -
r28930:e3f01188 default
parent child Browse files
Show More
@@ -1,198 +1,197 b''
1 1 #require test-repo
2 2
3 3 $ cd "$TESTDIR"/..
4 4
5 5 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
6 6 doc/check-seclevel.py not using absolute_import
7 7 doc/gendoc.py not using absolute_import
8 8 doc/hgmanpage.py not using absolute_import
9 9 hgext/color.py not using absolute_import
10 10 hgext/eol.py not using absolute_import
11 11 hgext/extdiff.py not using absolute_import
12 12 hgext/factotum.py not using absolute_import
13 13 hgext/fetch.py not using absolute_import
14 14 hgext/fsmonitor/pywatchman/__init__.py not using absolute_import
15 15 hgext/fsmonitor/pywatchman/__init__.py requires print_function
16 16 hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import
17 17 hgext/fsmonitor/pywatchman/pybser.py not using absolute_import
18 18 hgext/gpg.py not using absolute_import
19 19 hgext/graphlog.py not using absolute_import
20 20 hgext/hgcia.py not using absolute_import
21 21 hgext/hgk.py not using absolute_import
22 22 hgext/highlight/__init__.py not using absolute_import
23 23 hgext/highlight/highlight.py not using absolute_import
24 24 hgext/histedit.py not using absolute_import
25 25 hgext/largefiles/__init__.py not using absolute_import
26 26 hgext/largefiles/basestore.py not using absolute_import
27 27 hgext/largefiles/lfcommands.py not using absolute_import
28 28 hgext/largefiles/lfutil.py not using absolute_import
29 29 hgext/largefiles/localstore.py not using absolute_import
30 30 hgext/largefiles/overrides.py not using absolute_import
31 31 hgext/largefiles/proto.py not using absolute_import
32 32 hgext/largefiles/remotestore.py not using absolute_import
33 33 hgext/largefiles/reposetup.py not using absolute_import
34 34 hgext/largefiles/uisetup.py not using absolute_import
35 35 hgext/largefiles/wirestore.py not using absolute_import
36 36 hgext/mq.py not using absolute_import
37 37 hgext/rebase.py not using absolute_import
38 38 hgext/share.py not using absolute_import
39 39 hgext/win32text.py not using absolute_import
40 40 i18n/check-translation.py not using absolute_import
41 41 i18n/polib.py not using absolute_import
42 42 setup.py not using absolute_import
43 43 tests/heredoctest.py requires print_function
44 44 tests/killdaemons.py not using absolute_import
45 45 tests/md5sum.py not using absolute_import
46 46 tests/mockblackbox.py not using absolute_import
47 47 tests/printenv.py not using absolute_import
48 48 tests/readlink.py not using absolute_import
49 49 tests/readlink.py requires print_function
50 50 tests/revlog-formatv0.py not using absolute_import
51 51 tests/run-tests.py not using absolute_import
52 52 tests/sitecustomize.py not using absolute_import
53 53 tests/svn-safe-append.py not using absolute_import
54 54 tests/svnxml.py not using absolute_import
55 55 tests/test-atomictempfile.py not using absolute_import
56 56 tests/test-demandimport.py not using absolute_import
57 57 tests/test-demandimport.py requires print_function
58 58 tests/test-doctest.py not using absolute_import
59 59 tests/test-hgwebdir-paths.py not using absolute_import
60 tests/test-lrucachedict.py not using absolute_import
61 60 tests/test-lrucachedict.py requires print_function
62 61 tests/test-trusted.py requires print_function
63 62
64 63 #if py3exe
65 64 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
66 65 contrib/check-code.py: invalid syntax: (unicode error) 'unicodeescape' codec can't decode bytes in position *-*: malformed \N character escape (<unknown>, line *) (glob)
67 66 doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
68 67 hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
69 68 hgext/blackbox.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
70 69 hgext/bugzilla.py: error importing module: <ImportError> No module named 'urlparse' (line *) (glob)
71 70 hgext/censor.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
72 71 hgext/chgserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
73 72 hgext/children.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
74 73 hgext/churn.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
75 74 hgext/clonebundles.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
76 75 hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
77 76 hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
78 77 hgext/convert/common.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
79 78 hgext/convert/convcmd.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
80 79 hgext/convert/cvs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
81 80 hgext/convert/cvsps.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
82 81 hgext/convert/darcs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
83 82 hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
84 83 hgext/convert/git.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
85 84 hgext/convert/gnuarch.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
86 85 hgext/convert/hg.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
87 86 hgext/convert/monotone.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
88 87 hgext/convert/p*.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
89 88 hgext/convert/subversion.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
90 89 hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob)
91 90 hgext/eol.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
92 91 hgext/extdiff.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
93 92 hgext/factotum.py: error importing: <ImportError> No module named 'httplib' (error at url.py:*) (glob)
94 93 hgext/fetch.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
95 94 hgext/fsmonitor/watchmanclient.py: error importing module: <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) (glob)
96 95 hgext/gpg.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
97 96 hgext/graphlog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
98 97 hgext/hgcia.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
99 98 hgext/hgk.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
100 99 hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
101 100 hgext/keyword.py: error importing: <ImportError> No module named 'BaseHTTPServer' (error at common.py:*) (glob)
102 101 hgext/largefiles/basestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
103 102 hgext/largefiles/lfcommands.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
104 103 hgext/largefiles/lfutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
105 104 hgext/largefiles/localstore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob)
106 105 hgext/largefiles/overrides.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
107 106 hgext/largefiles/proto.py: error importing: <ImportError> No module named 'httplib' (error at httppeer.py:*) (glob)
108 107 hgext/largefiles/remotestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
109 108 hgext/largefiles/reposetup.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
110 109 hgext/largefiles/uisetup.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (line *) (glob)
111 110 hgext/largefiles/wirestore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob)
112 111 hgext/mq.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
113 112 hgext/notify.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
114 113 hgext/pager.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
115 114 hgext/patchbomb.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
116 115 hgext/purge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
117 116 hgext/rebase.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
118 117 hgext/record.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
119 118 hgext/relink.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
120 119 hgext/schemes.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
121 120 hgext/share.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
122 121 hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
123 122 hgext/strip.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
124 123 hgext/transplant.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
125 124 mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
126 125 mercurial/branchmap.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
127 126 mercurial/bundle*.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
128 127 mercurial/bundlerepo.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
129 128 mercurial/changegroup.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
130 129 mercurial/changelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
131 130 mercurial/cmdutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
132 131 mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
133 132 mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
134 133 mercurial/context.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
135 134 mercurial/copies.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
136 135 mercurial/crecord.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
137 136 mercurial/dirstate.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
138 137 mercurial/discovery.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
139 138 mercurial/dispatch.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
140 139 mercurial/exchange.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
141 140 mercurial/extensions.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
142 141 mercurial/filelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
143 142 mercurial/filemerge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
144 143 mercurial/fileset.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
145 144 mercurial/formatter.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
146 145 mercurial/graphmod.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
147 146 mercurial/help.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
148 147 mercurial/hg.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
149 148 mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
150 149 mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
151 150 mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
152 151 mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
153 152 mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
154 153 mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
155 154 mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
156 155 mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
157 156 mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
158 157 mercurial/hook.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
159 158 mercurial/httpclient/_readers.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
160 159 mercurial/httpconnection.py: error importing: <ImportError> No module named 'httplib' (error at __init__.py:*) (glob)
161 160 mercurial/httppeer.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
162 161 mercurial/keepalive.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
163 162 mercurial/localrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
164 163 mercurial/mail.py: error importing module: <AttributeError> module 'email' has no attribute 'Header' (line *) (glob)
165 164 mercurial/manifest.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
166 165 mercurial/merge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
167 166 mercurial/namespaces.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
168 167 mercurial/patch.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
169 168 mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob)
170 169 mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob)
171 170 mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
172 171 mercurial/revlog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
173 172 mercurial/revset.py: error importing module: <AttributeError> 'dict' object has no attribute 'iteritems' (line *) (glob)
174 173 mercurial/scmutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
175 174 mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
176 175 mercurial/simplemerge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
177 176 mercurial/sshpeer.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
178 177 mercurial/sshserver.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
179 178 mercurial/statichttprepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
180 179 mercurial/store.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
181 180 mercurial/streamclone.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
182 181 mercurial/subrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
183 182 mercurial/templatefilters.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
184 183 mercurial/templatekw.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
185 184 mercurial/templater.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
186 185 mercurial/ui.py: error importing: <ImportError> No module named 'cPickle' (error at formatter.py:*) (glob)
187 186 mercurial/unionrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
188 187 mercurial/url.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
189 188 mercurial/verify.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
190 189 mercurial/win*.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob)
191 190 mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
192 191 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
193 192 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
194 193 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
195 194 tests/test-lrucachedict.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
196 195 tests/test-trusted.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
197 196
198 197 #endif
@@ -1,70 +1,74 b''
1 from mercurial import util
1 from __future__ import absolute_import
2
3 from mercurial import (
4 util,
5 )
2 6
3 7 def printifpresent(d, xs, name='d'):
4 8 for x in xs:
5 9 present = x in d
6 10 print "'%s' in %s: %s" % (x, name, present)
7 11 if present:
8 12 print "%s['%s']: %s" % (name, x, d[x])
9 13
10 14 def test_lrucachedict():
11 15 d = util.lrucachedict(4)
12 16 d['a'] = 'va'
13 17 d['b'] = 'vb'
14 18 d['c'] = 'vc'
15 19 d['d'] = 'vd'
16 20
17 21 # all of these should be present
18 22 printifpresent(d, ['a', 'b', 'c', 'd'])
19 23
20 24 # 'a' should be dropped because it was least recently used
21 25 d['e'] = 've'
22 26 printifpresent(d, ['a', 'b', 'c', 'd', 'e'])
23 27
24 28 # touch entries in some order (get or set).
25 29 d['e']
26 30 d['c'] = 'vc2'
27 31 d['d']
28 32 d['b'] = 'vb2'
29 33
30 34 # 'e' should be dropped now
31 35 d['f'] = 'vf'
32 36 printifpresent(d, ['b', 'c', 'd', 'e', 'f'])
33 37
34 38 d.clear()
35 39 printifpresent(d, ['b', 'c', 'd', 'e', 'f'])
36 40
37 41 # Now test dicts that aren't full.
38 42 d = util.lrucachedict(4)
39 43 d['a'] = 1
40 44 d['b'] = 2
41 45 d['a']
42 46 d['b']
43 47 printifpresent(d, ['a', 'b'])
44 48
45 49 # test copy method
46 50 d = util.lrucachedict(4)
47 51 d['a'] = 'va3'
48 52 d['b'] = 'vb3'
49 53 d['c'] = 'vc3'
50 54 d['d'] = 'vd3'
51 55
52 56 dc = d.copy()
53 57
54 58 # all of these should be present
55 59 print "\nAll of these should be present:"
56 60 printifpresent(dc, ['a', 'b', 'c', 'd'], 'dc')
57 61
58 62 # 'a' should be dropped because it was least recently used
59 63 print "\nAll of these except 'a' should be present:"
60 64 dc['e'] = 've3'
61 65 printifpresent(dc, ['a', 'b', 'c', 'd', 'e'], 'dc')
62 66
63 67 # contents and order of original dict should remain unchanged
64 68 print "\nThese should be in reverse alphabetical order and read 'v?3':"
65 69 dc['b'] = 'vb3_new'
66 70 for k in list(iter(d)):
67 71 print "d['%s']: %s" % (k, d[k])
68 72
69 73 if __name__ == '__main__':
70 74 test_lrucachedict()
General Comments 0
You need to be logged in to leave comments. Login now