##// END OF EJS Templates
tests: try to import modules with Python 3...
Gregory Szorc -
r28584:d69172dd default
parent child Browse files
Show More
@@ -10,7 +10,10 b''
10 10 from __future__ import absolute_import, print_function
11 11
12 12 import ast
13 import imp
14 import os
13 15 import sys
16 import traceback
14 17
15 18 def check_compat_py2(f):
16 19 """Check Python 3 compatibility for a file with Python 2"""
@@ -47,6 +50,27 b' def check_compat_py3(f):'
47 50 print('%s: invalid syntax: %s' % (f, e))
48 51 return
49 52
53 # Try to import the module.
54 # For now we only support mercurial.* and hgext.* modules because figuring
55 # out module paths for things not in a package can be confusing.
56 if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'):
57 assert f.endswith('.py')
58 name = f.replace('/', '.')[:-3]
59 with open(f, 'r') as fh:
60 try:
61 imp.load_module(name, fh, '', ('py', 'r', imp.PY_SOURCE))
62 except Exception as e:
63 exc_type, exc_value, tb = sys.exc_info()
64 frame = traceback.extract_tb(tb)[-1]
65
66 if frame.filename:
67 filename = os.path.basename(frame.filename)
68 print('%s: error importing: <%s> %s (error at %s:%d)' % (
69 f, type(e).__name__, e, filename, frame.lineno))
70 else:
71 print('%s: error importing module: <%s> %s (line %d)' % (
72 f, type(e).__name__, e, frame.lineno))
73
50 74 if __name__ == '__main__':
51 75 if sys.version_info[0] == 2:
52 76 fn = check_compat_py2
@@ -125,10 +125,163 b''
125 125 contrib/import-checker.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line 569)
126 126 contrib/revsetbenchmarks.py: invalid syntax: invalid syntax (<unknown>, line 186)
127 127 doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line 286)
128 hgext/acl.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
129 hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line 3324) (line 29)
130 hgext/blackbox.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
131 hgext/bugzilla.py: error importing module: <ImportError> No module named 'urlparse' (line 284)
132 hgext/censor.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
133 hgext/chgserver.py: error importing module: <ImportError> No module named 'SocketServer' (line 43)
134 hgext/children.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
135 hgext/churn.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
136 hgext/clonebundles.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
128 137 hgext/color.py: invalid syntax: invalid syntax (<unknown>, line 551)
138 hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line 18)
139 hgext/convert/common.py: error importing module: <ImportError> No module named 'cPickle' (line 10)
140 hgext/convert/convcmd.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
141 hgext/convert/cvs.py: error importing module: <ImportError> No module named 'cStringIO' (line 9)
142 hgext/convert/cvsps.py: error importing module: <ImportError> No module named 'cPickle' (line 9)
143 hgext/convert/darcs.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
144 hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line 14)
145 hgext/convert/git.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
146 hgext/convert/gnuarch.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
147 hgext/convert/hg.py: error importing module: <ImportError> No module named 'cStringIO' (line 21)
148 hgext/convert/monotone.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
149 hgext/convert/p4.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
150 hgext/convert/subversion.py: error importing module: <ImportError> No module named 'cPickle' (line 6)
151 hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line 21)
152 hgext/eol.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
153 hgext/extdiff.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
154 hgext/factotum.py: error importing: <ImportError> No module named 'cStringIO' (error at url.py:13)
155 hgext/fetch.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
156 hgext/fsmonitor/state.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
157 hgext/fsmonitor/watchmanclient.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
158 hgext/gpg.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
159 hgext/graphlog.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
160 hgext/hgcia.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
161 hgext/hgk.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
162 hgext/highlight/highlight.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
163 hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line 977) (line 177)
164 hgext/keyword.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
165 hgext/largefiles/basestore.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
166 hgext/largefiles/lfcommands.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
167 hgext/largefiles/lfutil.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
168 hgext/largefiles/localstore.py: error importing module: <ImportError> No module named 'lfutil' (line 13)
169 hgext/largefiles/overrides.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
170 hgext/largefiles/proto.py: error importing module: <ImportError> No module named 'urllib2' (line 7)
171 hgext/largefiles/remotestore.py: error importing module: <ImportError> No module named 'urllib2' (line 9)
172 hgext/largefiles/reposetup.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
173 hgext/largefiles/uisetup.py: error importing module: <SyntaxError> invalid syntax (archival.py, line 234) (line 11)
174 hgext/largefiles/wirestore.py: error importing module: <ImportError> No module named 'lfutil' (line 8)
175 hgext/mq.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
176 hgext/notify.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
177 hgext/pager.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
178 hgext/patchbomb.py: error importing module: <ImportError> No module named 'cStringIO' (line 68)
179 hgext/purge.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
180 hgext/rebase.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
181 hgext/record.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
182 hgext/relink.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
183 hgext/schemes.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
184 hgext/share.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
185 hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line 977) (line 28)
186 hgext/strip.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
187 hgext/transplant.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
188 hgext/win32text.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
189 mercurial/ancestor.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
129 190 mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line 234)
191 mercurial/bookmarks.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
192 mercurial/branchmap.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
130 193 mercurial/bundle2.py: invalid syntax: invalid syntax (<unknown>, line 977)
194 mercurial/bundlerepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
195 mercurial/byterange.py: error importing module: <ImportError> No module named 'urllib2' (line 30)
196 mercurial/changegroup.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
197 mercurial/changelog.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
198 mercurial/cmdutil.py: error importing module: <ImportError> No module named 'cStringIO' (line 10)
131 199 mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line 3324)
200 mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line 10)
201 mercurial/config.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
202 mercurial/context.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
203 mercurial/copies.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
204 mercurial/crecord.py: error importing module: <ImportError> No module named 'cStringIO' (line 13)
205 mercurial/dagutil.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
206 mercurial/destutil.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
207 mercurial/dirstate.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
208 mercurial/discovery.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
209 mercurial/dispatch.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
210 mercurial/exchange.py: error importing module: <ImportError> No module named 'urllib2' (line 12)
211 mercurial/extensions.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
212 mercurial/filelog.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:10)
213 mercurial/filemerge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
214 mercurial/fileset.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
215 mercurial/formatter.py: error importing module: <ImportError> No module named 'cPickle' (line 10)
216 mercurial/graphmod.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
217 mercurial/hbisect.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
218 mercurial/help.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
219 mercurial/hg.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
220 mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line 11)
221 mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 14)
222 mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 15)
223 mercurial/hgweb/protocol.py: error importing module: <ImportError> No module named 'cStringIO' (line 10)
224 mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 15)
225 mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line 11)
226 mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 16)
227 mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 16)
228 mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 16)
229 mercurial/hook.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
230 mercurial/httpclient/_readers.py: error importing module: <ImportError> No module named 'httplib' (line 36)
231 mercurial/httpconnection.py: error importing module: <ImportError> No module named 'urllib2' (line 17)
232 mercurial/httppeer.py: error importing module: <ImportError> No module named 'httplib' (line 12)
233 mercurial/keepalive.py: error importing module: <ImportError> No module named 'httplib' (line 113)
234 mercurial/localrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
235 mercurial/lock.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
236 mercurial/mail.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
237 mercurial/manifest.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:10)
238 mercurial/match.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
239 mercurial/mdiff.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:10)
240 mercurial/merge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
241 mercurial/minirst.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
242 mercurial/namespaces.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
243 mercurial/node.py: error importing module: <TypeError> a bytes-like object is required, not 'str' (line 18)
244 mercurial/obsolete.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
245 mercurial/patch.py: error importing module: <ImportError> No module named 'cStringIO' (line 11)
246 mercurial/pathutil.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
247 mercurial/peer.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
248 mercurial/phases.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
249 mercurial/pure/mpatch.py: error importing module: <ImportError> No module named 'cStringIO' (line 10)
250 mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'cStringIO' (line 10)
251 mercurial/pushkey.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
252 mercurial/pvec.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
253 mercurial/registrar.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
254 mercurial/repair.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
255 mercurial/repoview.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
256 mercurial/revlog.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
257 mercurial/revset.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
258 mercurial/scmutil.py: error importing module: <ImportError> No module named 'Queue' (line 10)
259 mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line 3)
260 mercurial/setdiscovery.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
261 mercurial/similar.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:10)
262 mercurial/simplemerge.py: error importing: <ImportError> No module named 'cStringIO' (error at mpatch.py:10)
263 mercurial/sshpeer.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
264 mercurial/sshserver.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
265 mercurial/sslutil.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
266 mercurial/statichttprepo.py: error importing module: <ImportError> No module named 'urllib2' (line 15)
267 mercurial/store.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
268 mercurial/streamclone.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
269 mercurial/subrepo.py: error importing: <ImportError> No module named 'cStringIO' (error at cmdutil.py:10)
270 mercurial/tagmerge.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
271 mercurial/tags.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
272 mercurial/templatefilters.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
273 mercurial/templatekw.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
274 mercurial/templater.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
275 mercurial/transaction.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
276 mercurial/treediscovery.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
277 mercurial/ui.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
278 mercurial/unionrepo.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
279 mercurial/url.py: error importing module: <ImportError> No module named 'cStringIO' (line 13)
280 mercurial/util.py: error importing: <ImportError> No module named 'cStringIO' (error at parsers.py:10)
281 mercurial/verify.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
282 mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line 12)
283 mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line 10)
284 mercurial/wireproto.py: error importing: <TypeError> a bytes-like object is required, not 'str' (error at node.py:18)
132 285 tests/filterpyflakes.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line 61)
133 286 tests/generate-working-copy-states.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line 69)
134 287 tests/get-with-headers.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line 44)
General Comments 0
You need to be logged in to leave comments. Login now