[PATCH]readlink.py: use absolute_import, print_function
Gregory Szorc
gregory.szorc at gmail.com
Sat Mar 26 13:33:54 EDT 2016
On Thu, Mar 24, 2016 at 9:58 PM, roby roby <robert.stanca7 at gmail.com> wrote:
> # HG changeset patch
> # User Robert Stanca <robert.stanca7 at gmail.com>
> # Date 1458881547 -7200
> # Fri Mar 25 06:52:27 2016 +0200
> # Node ID 4d056674733ef697f08301412ce8a07504484184
> # Parent a6146f7e27f8a9875c34d746d7dc87b74dac1c6d
> readlink.py: use absolute_import, print_function
>
> diff -r a6146f7e27f8 -r 4d056674733e tests/readlink.py
> --- a/tests/readlink.py Fri Mar 25 06:47:34 2016 +0200
> +++ b/tests/readlink.py Fri Mar 25 06:52:27 2016 +0200
> @@ -1,13 +1,16 @@
> #!/usr/bin/env python
>
> -import errno, os, sys
> +from __future__ import absolute_import , print_function
> +import errno
> +import os
> +import sys
>
> for f in sys.argv[1:]:
> try:
> - print f, '->', os.readlink(f)
> + print (f, '->', os.readlink(f))
> except OSError as err:
> if err.errno != errno.EINVAL:
> raise
> - print f, 'not a symlink'
> + print (f, 'not a symlink')
>
There should be no space between "print" and "(".
>
> sys.exit(0)
> diff -r a6146f7e27f8 -r 4d056674733e tests/test-check-py3-compat.t
> --- a/tests/test-check-py3-compat.t Fri Mar 25 06:47:34 2016 +0200
> +++ b/tests/test-check-py3-compat.t Fri Mar 25 06:52:27 2016 +0200
> @@ -52,8 +52,6 @@
> tests/md5sum.py not using absolute_import
> tests/mockblackbox.py not using absolute_import
> tests/printenv.py not using absolute_import
> - tests/readlink.py not using absolute_import
> - tests/readlink.py requires print_function
> tests/revlog-formatv0.py not using absolute_import
> tests/run-tests.py not using absolute_import
> tests/seq.py not using absolute_import
>
>
There is a new section at the bottom of this test that contains some
redundant entries if a file cannot be parsed as valid Python 3 (this
happens when the "print" statement is used for example). So you'll need to
update that section when adding print functions.
You'll need to have Python 3.5 installed and do `run-tests.py
--with-python3=path/to/python3.5` to get this section to execute when you
run test-check-py3-compat.t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160326/1d57ecf6/attachment.html>
More information about the Mercurial-devel
mailing list