diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -338,7 +338,7 @@ aliases, entry = cmdutil.findcmd(name, commands.table, strict=unknowncmd) except error.AmbiguousCommand as inst: - # py3k fix: except vars can't be used outside the scope of the + # py3 fix: except vars can't be used outside the scope of the # except block, nor can be used inside a lambda. python issue4617 prefix = inst.args[0] select = lambda c: cmdutil.parsealiases(c)[0].startswith(prefix) diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -641,8 +641,8 @@ # chg disables demandimport intentionally for performance wins. return ((not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable') -@check("py3k", "running with Python 3.x") -def has_py3k(): +@check("py3", "running with Python 3.x") +def has_py3(): return 3 == sys.version_info[0] @check("py3exe", "a Python 3.x interpreter is available") diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -425,7 +425,7 @@ help="prefer IPv6 to IPv4 for network related tests") hgconf.add_argument("--pure", action="store_true", help="use pure Python code instead of C extensions") - hgconf.add_argument("-3", "--py3k-warnings", action="store_true", + hgconf.add_argument("-3", "--py3-warnings", action="store_true", help="enable Py3k warnings on Python 2.7+") hgconf.add_argument("--with-chg", metavar="CHG", help="use specified chg wrapper in place of hg") @@ -562,10 +562,10 @@ 'warning: --slowtimeout option ignored with --debug\n') options.timeout = 0 options.slowtimeout = 0 - if options.py3k_warnings: + if options.py3_warnings: if PYTHON3: parser.error( - '--py3k-warnings can only be used on Python 2.7') + '--py3-warnings can only be used on Python 2.7') if options.blacklist: options.blacklist = parselistfiles(options.blacklist, 'blacklist') @@ -689,7 +689,7 @@ first=False, timeout=None, startport=None, extraconfigopts=None, - py3kwarnings=False, shell=None, hgcommand=None, + py3warnings=False, shell=None, hgcommand=None, slowtimeout=None, usechg=False, useipv6=False): """Create a test from parameters. @@ -718,7 +718,7 @@ must have the form "key=value" (something understood by hgrc). Values of the form "foo.key=value" will result in "[foo] key=value". - py3kwarnings enables Py3k warnings. + py3warnings enables Py3k warnings. shell is the shell to execute tests in. """ @@ -744,7 +744,7 @@ self._slowtimeout = slowtimeout self._startport = startport self._extraconfigopts = extraconfigopts or [] - self._py3kwarnings = py3kwarnings + self._py3warnings = py3warnings self._shell = _bytespath(shell) self._hgcommand = hgcommand or b'hg' self._usechg = usechg @@ -1218,8 +1218,8 @@ return os.path.join(self._testdir, b'%s.out' % self.bname) def _run(self, env): - py3kswitch = self._py3kwarnings and b' -3' or b'' - cmd = b'"%s"%s "%s"' % (PYTHON, py3kswitch, self.path) + py3switch = self._py3warnings and b' -3' or b'' + cmd = b'%s%s "%s"' % (PYTHON, py3switch, self.path) vlog("# Running", cmd) normalizenewlines = os.name == 'nt' result = self._runcommand(cmd, env, @@ -2897,7 +2897,7 @@ timeout=self.options.timeout, startport=self._getport(count), extraconfigopts=self.options.extra_config_opt, - py3kwarnings=self.options.py3k_warnings, + py3warnings=self.options.py3_warnings, shell=self.options.shell, hgcommand=self._hgcommand, usechg=bool(self.options.with_chg or self.options.chg), @@ -3029,7 +3029,7 @@ self._usecorrectpython() - if self.options.py3k_warnings and not self.options.anycoverage: + if self.options.py3_warnings and not self.options.anycoverage: vlog("# Updating hg command to enable Py3k Warnings switch") with open(os.path.join(self._bindir, 'hg'), 'rb') as f: lines = [line.rstrip() for line in f] diff --git a/tests/test-archive.t b/tests/test-archive.t --- a/tests/test-archive.t +++ b/tests/test-archive.t @@ -187,8 +187,8 @@ server: testing stub value transfer-encoding: chunked - body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3k !) - body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3k !) + body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3 !) + body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3 !) % tar.gz and tar.bz2 disallowed should both give 403 403 Archive type not allowed: gz content-type: text/html; charset=ascii @@ -275,8 +275,8 @@ server: testing stub value transfer-encoding: chunked - body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3k !) - body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3k !) + body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650 (no-py3 !) + body: size=1461, sha1=be6d3983aa13dfe930361b2569291cdedd02b537 (py3 !) % tar.gz and tar.bz2 disallowed should both give 403 403 Archive type not allowed: gz content-type: text/html; charset=ascii diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t --- a/tests/test-bad-extension.t +++ b/tests/test-bad-extension.t @@ -57,12 +57,12 @@ Exception: bit bucket overflow *** failed to import extension badext2: No module named *badext2* (glob) Traceback (most recent call last): - ImportError: No module named badext2 (no-py3k !) - ModuleNotFoundError: No module named 'hgext.badext2' (py3k !) - Traceback (most recent call last): (py3k !) - ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3k !) - Traceback (most recent call last): (py3k !) - ModuleNotFoundError: No module named 'badext2' (py3k !) + ImportError: No module named badext2 (no-py3 !) + ModuleNotFoundError: No module named 'hgext.badext2' (py3 !) + Traceback (most recent call last): (py3 !) + ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !) + Traceback (most recent call last): (py3 !) + ModuleNotFoundError: No module named 'badext2' (py3 !) names of extensions failed to load can be accessed via extensions.notloaded() @@ -102,22 +102,22 @@ debug.extensions: - loading extension: 'badext2' debug.extensions: - could not import hgext.badext2 (No module named *badext2*): trying hgext3rd.badext2 (glob) Traceback (most recent call last): - ImportError: No module named badext2 (no-py3k !) - ModuleNotFoundError: No module named 'hgext.badext2' (py3k !) + ImportError: No module named badext2 (no-py3 !) + ModuleNotFoundError: No module named 'hgext.badext2' (py3 !) debug.extensions: - could not import hgext3rd.badext2 (No module named *badext2*): trying badext2 (glob) Traceback (most recent call last): - ImportError: No module named badext2 (no-py3k !) - ModuleNotFoundError: No module named 'hgext.badext2' (py3k !) - Traceback (most recent call last): (py3k !) - ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3k !) + ImportError: No module named badext2 (no-py3 !) + ModuleNotFoundError: No module named 'hgext.badext2' (py3 !) + Traceback (most recent call last): (py3 !) + ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !) *** failed to import extension badext2: No module named *badext2* (glob) Traceback (most recent call last): - ModuleNotFoundError: No module named 'hgext.badext2' (py3k !) - Traceback (most recent call last): (py3k !) - ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3k !) - Traceback (most recent call last): (py3k !) - ModuleNotFoundError: No module named 'badext2' (py3k !) - ImportError: No module named badext2 (no-py3k !) + ModuleNotFoundError: No module named 'hgext.badext2' (py3 !) + Traceback (most recent call last): (py3 !) + ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !) + Traceback (most recent call last): (py3 !) + ModuleNotFoundError: No module named 'badext2' (py3 !) + ImportError: No module named badext2 (no-py3 !) debug.extensions: > loaded 2 extensions, total time * (glob) debug.extensions: - loading configtable attributes debug.extensions: - executing uisetup hooks diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -3,7 +3,7 @@ $ . "$TESTDIR/helpers-testrepo.sh" $ cd "$TESTDIR"/.. -#if no-py3k +#if no-py3 $ testrepohg files 'set:(**.py)' \ > -X hgdemandimport/demandimportpy2.py \ > -X mercurial/thirdparty/cbor \ @@ -24,7 +24,7 @@ setup.py not using absolute_import #endif -#if py3k +#if py3 $ testrepohg files 'set:(**.py) - grep(pygments)' \ > -X hgdemandimport/demandimportpy2.py \ > -X hgext/fsmonitor/pywatchman \ @@ -41,7 +41,7 @@ mercurial/scmposix.py: error importing: No module named 'fcntl' (error at scmposix.py:*) (windows !) #endif -#if py3k pygments +#if py3 pygments $ testrepohg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \ > | xargs "$PYTHON" contrib/check-py3-compat.py \ > | sed 's/[0-9][0-9]*)$/*)/' diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -203,8 +203,8 @@ { "chainid": 1, "chainlen": 1, - "chainratio": 1.02325581395, (no-py3k !) - "chainratio": 1.0232558139534884, (py3k !) + "chainratio": 1.02325581395, (no-py3 !) + "chainratio": 1.0232558139534884, (py3 !) "chainsize": 44, "compsize": 44, "deltatype": "base", @@ -232,8 +232,8 @@ { "chainid": 3, "chainlen": 1, - "chainratio": 1.02325581395, (no-py3k !) - "chainratio": 1.0232558139534884, (py3k !) + "chainratio": 1.02325581395, (no-py3 !) + "chainratio": 1.0232558139534884, (py3 !) "chainsize": 44, "compsize": 44, "deltatype": "base", @@ -268,8 +268,8 @@ { "chainid": 1, "chainlen": 1, - "chainratio": 1.02325581395, (no-py3k !) - "chainratio": 1.0232558139534884, (py3k !) + "chainratio": 1.02325581395, (no-py3 !) + "chainratio": 1.0232558139534884, (py3 !) "chainsize": 44, "compsize": 44, "deltatype": "base", @@ -305,8 +305,8 @@ { "chainid": 3, "chainlen": 1, - "chainratio": 1.02325581395, (no-py3k !) - "chainratio": 1.0232558139534884, (py3k !) + "chainratio": 1.02325581395, (no-py3 !) + "chainratio": 1.0232558139534884, (py3 !) "chainsize": 44, "compsize": 44, "deltatype": "base", diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -222,7 +222,7 @@ ambigabs.s=libroot/ambig.py $TESTTMP/a -#if no-py3k +#if no-py3 $ cat > $TESTTMP/libroot/mod/ambigrel.py < from __future__ import print_function > import ambig # should load "libroot/mod/ambig.py" @@ -290,7 +290,7 @@ (extroot) import extroot.bar in func(): this is extroot.bar $TESTTMP/a -#if no-py3k +#if no-py3 $ rm "$TESTTMP"/extroot/foo.* $ rm -Rf "$TESTTMP/extroot/__pycache__" $ cat > $TESTTMP/extroot/foo.py <&1 | grep -i 'traceback' Traceback (most recent call last): - Traceback (most recent call last): (py3k !) + Traceback (most recent call last): (py3 !) #else Traceback for '--config' errors not supported with chg. $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'