##// END OF EJS Templates
py3: use py3 as the test tag, dropping the k...
Martijn Pieters -
r40299:8cf459d8 default
parent child Browse files
Show More
@@ -338,7 +338,7 b' def help_(ui, commands, name, unknowncmd'
338 aliases, entry = cmdutil.findcmd(name, commands.table,
338 aliases, entry = cmdutil.findcmd(name, commands.table,
339 strict=unknowncmd)
339 strict=unknowncmd)
340 except error.AmbiguousCommand as inst:
340 except error.AmbiguousCommand as inst:
341 # py3k fix: except vars can't be used outside the scope of the
341 # py3 fix: except vars can't be used outside the scope of the
342 # except block, nor can be used inside a lambda. python issue4617
342 # except block, nor can be used inside a lambda. python issue4617
343 prefix = inst.args[0]
343 prefix = inst.args[0]
344 select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
344 select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix)
@@ -641,8 +641,8 b' def has_demandimport():'
641 # chg disables demandimport intentionally for performance wins.
641 # chg disables demandimport intentionally for performance wins.
642 return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable')
642 return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable')
643
643
644 @check("py3k", "running with Python 3.x")
644 @check("py3", "running with Python 3.x")
645 def has_py3k():
645 def has_py3():
646 return 3 == sys.version_info[0]
646 return 3 == sys.version_info[0]
647
647
648 @check("py3exe", "a Python 3.x interpreter is available")
648 @check("py3exe", "a Python 3.x interpreter is available")
@@ -425,7 +425,7 b' def getparser():'
425 help="prefer IPv6 to IPv4 for network related tests")
425 help="prefer IPv6 to IPv4 for network related tests")
426 hgconf.add_argument("--pure", action="store_true",
426 hgconf.add_argument("--pure", action="store_true",
427 help="use pure Python code instead of C extensions")
427 help="use pure Python code instead of C extensions")
428 hgconf.add_argument("-3", "--py3k-warnings", action="store_true",
428 hgconf.add_argument("-3", "--py3-warnings", action="store_true",
429 help="enable Py3k warnings on Python 2.7+")
429 help="enable Py3k warnings on Python 2.7+")
430 hgconf.add_argument("--with-chg", metavar="CHG",
430 hgconf.add_argument("--with-chg", metavar="CHG",
431 help="use specified chg wrapper in place of hg")
431 help="use specified chg wrapper in place of hg")
@@ -562,10 +562,10 b' def parseargs(args, parser):'
562 'warning: --slowtimeout option ignored with --debug\n')
562 'warning: --slowtimeout option ignored with --debug\n')
563 options.timeout = 0
563 options.timeout = 0
564 options.slowtimeout = 0
564 options.slowtimeout = 0
565 if options.py3k_warnings:
565 if options.py3_warnings:
566 if PYTHON3:
566 if PYTHON3:
567 parser.error(
567 parser.error(
568 '--py3k-warnings can only be used on Python 2.7')
568 '--py3-warnings can only be used on Python 2.7')
569
569
570 if options.blacklist:
570 if options.blacklist:
571 options.blacklist = parselistfiles(options.blacklist, 'blacklist')
571 options.blacklist = parselistfiles(options.blacklist, 'blacklist')
@@ -689,7 +689,7 b' class Test(unittest.TestCase):'
689 first=False,
689 first=False,
690 timeout=None,
690 timeout=None,
691 startport=None, extraconfigopts=None,
691 startport=None, extraconfigopts=None,
692 py3kwarnings=False, shell=None, hgcommand=None,
692 py3warnings=False, shell=None, hgcommand=None,
693 slowtimeout=None, usechg=False,
693 slowtimeout=None, usechg=False,
694 useipv6=False):
694 useipv6=False):
695 """Create a test from parameters.
695 """Create a test from parameters.
@@ -718,7 +718,7 b' class Test(unittest.TestCase):'
718 must have the form "key=value" (something understood by hgrc). Values
718 must have the form "key=value" (something understood by hgrc). Values
719 of the form "foo.key=value" will result in "[foo] key=value".
719 of the form "foo.key=value" will result in "[foo] key=value".
720
720
721 py3kwarnings enables Py3k warnings.
721 py3warnings enables Py3k warnings.
722
722
723 shell is the shell to execute tests in.
723 shell is the shell to execute tests in.
724 """
724 """
@@ -744,7 +744,7 b' class Test(unittest.TestCase):'
744 self._slowtimeout = slowtimeout
744 self._slowtimeout = slowtimeout
745 self._startport = startport
745 self._startport = startport
746 self._extraconfigopts = extraconfigopts or []
746 self._extraconfigopts = extraconfigopts or []
747 self._py3kwarnings = py3kwarnings
747 self._py3warnings = py3warnings
748 self._shell = _bytespath(shell)
748 self._shell = _bytespath(shell)
749 self._hgcommand = hgcommand or b'hg'
749 self._hgcommand = hgcommand or b'hg'
750 self._usechg = usechg
750 self._usechg = usechg
@@ -1218,8 +1218,8 b' class PythonTest(Test):'
1218 return os.path.join(self._testdir, b'%s.out' % self.bname)
1218 return os.path.join(self._testdir, b'%s.out' % self.bname)
1219
1219
1220 def _run(self, env):
1220 def _run(self, env):
1221 py3kswitch = self._py3kwarnings and b' -3' or b''
1221 py3switch = self._py3warnings and b' -3' or b''
1222 cmd = b'"%s"%s "%s"' % (PYTHON, py3kswitch, self.path)
1222 cmd = b'%s%s "%s"' % (PYTHON, py3switch, self.path)
1223 vlog("# Running", cmd)
1223 vlog("# Running", cmd)
1224 normalizenewlines = os.name == 'nt'
1224 normalizenewlines = os.name == 'nt'
1225 result = self._runcommand(cmd, env,
1225 result = self._runcommand(cmd, env,
@@ -2897,7 +2897,7 b' class TestRunner(object):'
2897 timeout=self.options.timeout,
2897 timeout=self.options.timeout,
2898 startport=self._getport(count),
2898 startport=self._getport(count),
2899 extraconfigopts=self.options.extra_config_opt,
2899 extraconfigopts=self.options.extra_config_opt,
2900 py3kwarnings=self.options.py3k_warnings,
2900 py3warnings=self.options.py3_warnings,
2901 shell=self.options.shell,
2901 shell=self.options.shell,
2902 hgcommand=self._hgcommand,
2902 hgcommand=self._hgcommand,
2903 usechg=bool(self.options.with_chg or self.options.chg),
2903 usechg=bool(self.options.with_chg or self.options.chg),
@@ -3029,7 +3029,7 b' class TestRunner(object):'
3029
3029
3030 self._usecorrectpython()
3030 self._usecorrectpython()
3031
3031
3032 if self.options.py3k_warnings and not self.options.anycoverage:
3032 if self.options.py3_warnings and not self.options.anycoverage:
3033 vlog("# Updating hg command to enable Py3k Warnings switch")
3033 vlog("# Updating hg command to enable Py3k Warnings switch")
3034 with open(os.path.join(self._bindir, 'hg'), 'rb') as f:
3034 with open(os.path.join(self._bindir, 'hg'), 'rb') as f:
3035 lines = [line.rstrip() for line in f]
3035 lines = [line.rstrip() for line in f]
@@ -187,8 +187,8 b' check http return codes'
187 server: testing stub value
187 server: testing stub value
188 transfer-encoding: chunked
188 transfer-encoding: chunked
189
189
190 body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3k !)
190 body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3 !)
191 body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3k !)
191 body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3 !)
192 % tar.gz and tar.bz2 disallowed should both give 403
192 % tar.gz and tar.bz2 disallowed should both give 403
193 403 Archive type not allowed: gz
193 403 Archive type not allowed: gz
194 content-type: text/html; charset=ascii
194 content-type: text/html; charset=ascii
@@ -275,8 +275,8 b' check http return codes (with deprecated'
275 server: testing stub value
275 server: testing stub value
276 transfer-encoding: chunked
276 transfer-encoding: chunked
277
277
278 body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3k !)
278 body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3 !)
279 body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3k !)
279 body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3 !)
280 % tar.gz and tar.bz2 disallowed should both give 403
280 % tar.gz and tar.bz2 disallowed should both give 403
281 403 Archive type not allowed: gz
281 403 Archive type not allowed: gz
282 content-type: text/html; charset=ascii
282 content-type: text/html; charset=ascii
@@ -57,12 +57,12 b' show traceback'
57 Exception: bit bucket overflow
57 Exception: bit bucket overflow
58 *** failed to import extension badext2: No module named *badext2* (glob)
58 *** failed to import extension badext2: No module named *badext2* (glob)
59 Traceback (most recent call last):
59 Traceback (most recent call last):
60 ImportError: No module named badext2 (no-py3k !)
60 ImportError: No module named badext2 (no-py3 !)
61 ModuleNotFoundError: No module named 'hgext.badext2' (py3k !)
61 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
62 Traceback (most recent call last): (py3k !)
62 Traceback (most recent call last): (py3 !)
63 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3k !)
63 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !)
64 Traceback (most recent call last): (py3k !)
64 Traceback (most recent call last): (py3 !)
65 ModuleNotFoundError: No module named 'badext2' (py3k !)
65 ModuleNotFoundError: No module named 'badext2' (py3 !)
66
66
67 names of extensions failed to load can be accessed via extensions.notloaded()
67 names of extensions failed to load can be accessed via extensions.notloaded()
68
68
@@ -102,22 +102,22 b' show traceback for ImportError of hgext.'
102 debug.extensions: - loading extension: 'badext2'
102 debug.extensions: - loading extension: 'badext2'
103 debug.extensions: - could not import hgext.badext2 (No module named *badext2*): trying hgext3rd.badext2 (glob)
103 debug.extensions: - could not import hgext.badext2 (No module named *badext2*): trying hgext3rd.badext2 (glob)
104 Traceback (most recent call last):
104 Traceback (most recent call last):
105 ImportError: No module named badext2 (no-py3k !)
105 ImportError: No module named badext2 (no-py3 !)
106 ModuleNotFoundError: No module named 'hgext.badext2' (py3k !)
106 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
107 debug.extensions: - could not import hgext3rd.badext2 (No module named *badext2*): trying badext2 (glob)
107 debug.extensions: - could not import hgext3rd.badext2 (No module named *badext2*): trying badext2 (glob)
108 Traceback (most recent call last):
108 Traceback (most recent call last):
109 ImportError: No module named badext2 (no-py3k !)
109 ImportError: No module named badext2 (no-py3 !)
110 ModuleNotFoundError: No module named 'hgext.badext2' (py3k !)
110 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
111 Traceback (most recent call last): (py3k !)
111 Traceback (most recent call last): (py3 !)
112 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3k !)
112 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !)
113 *** failed to import extension badext2: No module named *badext2* (glob)
113 *** failed to import extension badext2: No module named *badext2* (glob)
114 Traceback (most recent call last):
114 Traceback (most recent call last):
115 ModuleNotFoundError: No module named 'hgext.badext2' (py3k !)
115 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
116 Traceback (most recent call last): (py3k !)
116 Traceback (most recent call last): (py3 !)
117 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3k !)
117 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !)
118 Traceback (most recent call last): (py3k !)
118 Traceback (most recent call last): (py3 !)
119 ModuleNotFoundError: No module named 'badext2' (py3k !)
119 ModuleNotFoundError: No module named 'badext2' (py3 !)
120 ImportError: No module named badext2 (no-py3k !)
120 ImportError: No module named badext2 (no-py3 !)
121 debug.extensions: > loaded 2 extensions, total time * (glob)
121 debug.extensions: > loaded 2 extensions, total time * (glob)
122 debug.extensions: - loading configtable attributes
122 debug.extensions: - loading configtable attributes
123 debug.extensions: - executing uisetup hooks
123 debug.extensions: - executing uisetup hooks
@@ -3,7 +3,7 b''
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ cd "$TESTDIR"/..
4 $ cd "$TESTDIR"/..
5
5
6 #if no-py3k
6 #if no-py3
7 $ testrepohg files 'set:(**.py)' \
7 $ testrepohg files 'set:(**.py)' \
8 > -X hgdemandimport/demandimportpy2.py \
8 > -X hgdemandimport/demandimportpy2.py \
9 > -X mercurial/thirdparty/cbor \
9 > -X mercurial/thirdparty/cbor \
@@ -24,7 +24,7 b''
24 setup.py not using absolute_import
24 setup.py not using absolute_import
25 #endif
25 #endif
26
26
27 #if py3k
27 #if py3
28 $ testrepohg files 'set:(**.py) - grep(pygments)' \
28 $ testrepohg files 'set:(**.py) - grep(pygments)' \
29 > -X hgdemandimport/demandimportpy2.py \
29 > -X hgdemandimport/demandimportpy2.py \
30 > -X hgext/fsmonitor/pywatchman \
30 > -X hgext/fsmonitor/pywatchman \
@@ -41,7 +41,7 b''
41 mercurial/scmposix.py: error importing: <ModuleNotFoundError> No module named 'fcntl' (error at scmposix.py:*) (windows !)
41 mercurial/scmposix.py: error importing: <ModuleNotFoundError> No module named 'fcntl' (error at scmposix.py:*) (windows !)
42 #endif
42 #endif
43
43
44 #if py3k pygments
44 #if py3 pygments
45 $ testrepohg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
45 $ testrepohg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
46 > | xargs "$PYTHON" contrib/check-py3-compat.py \
46 > | xargs "$PYTHON" contrib/check-py3-compat.py \
47 > | sed 's/[0-9][0-9]*)$/*)/'
47 > | sed 's/[0-9][0-9]*)$/*)/'
@@ -203,8 +203,8 b' debugdelta chain basic output'
203 {
203 {
204 "chainid": 1,
204 "chainid": 1,
205 "chainlen": 1,
205 "chainlen": 1,
206 "chainratio": 1.02325581395, (no-py3k !)
206 "chainratio": 1.02325581395, (no-py3 !)
207 "chainratio": 1.0232558139534884, (py3k !)
207 "chainratio": 1.0232558139534884, (py3 !)
208 "chainsize": 44,
208 "chainsize": 44,
209 "compsize": 44,
209 "compsize": 44,
210 "deltatype": "base",
210 "deltatype": "base",
@@ -232,8 +232,8 b' debugdelta chain basic output'
232 {
232 {
233 "chainid": 3,
233 "chainid": 3,
234 "chainlen": 1,
234 "chainlen": 1,
235 "chainratio": 1.02325581395, (no-py3k !)
235 "chainratio": 1.02325581395, (no-py3 !)
236 "chainratio": 1.0232558139534884, (py3k !)
236 "chainratio": 1.0232558139534884, (py3 !)
237 "chainsize": 44,
237 "chainsize": 44,
238 "compsize": 44,
238 "compsize": 44,
239 "deltatype": "base",
239 "deltatype": "base",
@@ -268,8 +268,8 b' debugdelta chain with sparse read enable'
268 {
268 {
269 "chainid": 1,
269 "chainid": 1,
270 "chainlen": 1,
270 "chainlen": 1,
271 "chainratio": 1.02325581395, (no-py3k !)
271 "chainratio": 1.02325581395, (no-py3 !)
272 "chainratio": 1.0232558139534884, (py3k !)
272 "chainratio": 1.0232558139534884, (py3 !)
273 "chainsize": 44,
273 "chainsize": 44,
274 "compsize": 44,
274 "compsize": 44,
275 "deltatype": "base",
275 "deltatype": "base",
@@ -305,8 +305,8 b' debugdelta chain with sparse read enable'
305 {
305 {
306 "chainid": 3,
306 "chainid": 3,
307 "chainlen": 1,
307 "chainlen": 1,
308 "chainratio": 1.02325581395, (no-py3k !)
308 "chainratio": 1.02325581395, (no-py3 !)
309 "chainratio": 1.0232558139534884, (py3k !)
309 "chainratio": 1.0232558139534884, (py3 !)
310 "chainsize": 44,
310 "chainsize": 44,
311 "compsize": 44,
311 "compsize": 44,
312 "deltatype": "base",
312 "deltatype": "base",
@@ -222,7 +222,7 b' limit mark, regardless of importing modu'
222 ambigabs.s=libroot/ambig.py
222 ambigabs.s=libroot/ambig.py
223 $TESTTMP/a
223 $TESTTMP/a
224
224
225 #if no-py3k
225 #if no-py3
226 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF
226 $ cat > $TESTTMP/libroot/mod/ambigrel.py <<NO_CHECK_EOF
227 > from __future__ import print_function
227 > from __future__ import print_function
228 > import ambig # should load "libroot/mod/ambig.py"
228 > import ambig # should load "libroot/mod/ambig.py"
@@ -290,7 +290,7 b' Check absolute/relative import of extens'
290 (extroot) import extroot.bar in func(): this is extroot.bar
290 (extroot) import extroot.bar in func(): this is extroot.bar
291 $TESTTMP/a
291 $TESTTMP/a
292
292
293 #if no-py3k
293 #if no-py3
294 $ rm "$TESTTMP"/extroot/foo.*
294 $ rm "$TESTTMP"/extroot/foo.*
295 $ rm -Rf "$TESTTMP/extroot/__pycache__"
295 $ rm -Rf "$TESTTMP/extroot/__pycache__"
296 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
296 $ cat > $TESTTMP/extroot/foo.py <<NO_CHECK_EOF
@@ -267,7 +267,7 b' Testing --traceback:'
267 #if no-chg
267 #if no-chg
268 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
268 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
269 Traceback (most recent call last):
269 Traceback (most recent call last):
270 Traceback (most recent call last): (py3k !)
270 Traceback (most recent call last): (py3 !)
271 #else
271 #else
272 Traceback for '--config' errors not supported with chg.
272 Traceback for '--config' errors not supported with chg.
273 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
273 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
General Comments 0
You need to be logged in to leave comments. Login now