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/mercurial/thirdparty/zope/interface/_compat.py b/mercurial/thirdparty/zope/interface/_compat.py --- a/mercurial/thirdparty/zope/interface/_compat.py +++ b/mercurial/thirdparty/zope/interface/_compat.py @@ -50,7 +50,7 @@ PYTHON3 = True PYTHON2 = False -def _skip_under_py3k(test_method): +def _skip_under_py3(test_method): import unittest return unittest.skipIf(sys.version_info[0] >= 3, "Only on Python 2")(test_method) 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 @@ -424,7 +424,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") @@ -561,10 +561,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') @@ -688,7 +688,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. @@ -717,7 +717,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. """ @@ -743,7 +743,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 @@ -1217,8 +1217,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, @@ -2891,7 +2891,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), @@ -3023,7 +3023,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-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'