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