Commit Graph

31 Commits

Author SHA1 Message Date
Matt Harbison
3cab7ba2f7 tests: convert directory separators to '/' for MSYS in test-check-py-compat
This is the same fix as ca24c20a1c94.
2015-12-16 17:22:37 -05:00
Gregory Szorc
25c5781010 revlog: use absolute_import 2015-12-12 23:22:18 -08:00
Gregory Szorc
c66a27807d windows: use absolute_import 2015-12-12 23:19:38 -08:00
Gregory Szorc
5c29ba6835 similar: use absolute_import 2015-12-12 23:17:22 -08:00
Gregory Szorc
7b3fa04da1 util: use absolute_import 2015-12-12 23:14:08 -08:00
Gregory Szorc
5d71f3b2b9 encoding: use absolute_import 2015-12-12 22:57:48 -05:00
Yuya Nishihara
a881bac864 commandserver: use absolute_import 2015-11-24 22:58:40 +09:00
Gregory Szorc
98bb2fb083 parsers: use absolute_import 2015-12-12 13:39:29 -05:00
Gregory Szorc
3fccff1c87 osutil: use absolute_import 2015-12-12 13:46:32 -05:00
Gregory Szorc
132a5b6d98 mpatch: use absolute_import
While I was here, I removed the try..except around importing cStringIO
because cStringIO should always be importable on modern Python versions.
We already do an unconditional import in other files.
2015-12-12 13:37:56 -05:00
Gregory Szorc
d6131e9cde diffhelpers: use absolute_import 2015-12-12 13:35:41 -05:00
Gregory Szorc
38f154a7ae bdiff: use absolute_import 2015-12-12 13:34:55 -05:00
Gregory Szorc
631c25fecc base85: use absolute_import 2015-12-12 13:33:47 -05:00
Gregory Szorc
71b5e83cd8 destutil: use absolute_import 2015-12-12 13:32:25 -05:00
Gregory Szorc
06ebc04a42 obsolete: use absolute_import 2015-12-12 13:30:47 -05:00
Gregory Szorc
164cea475f contrib: ignore empty files in check-py3-compat.py 2015-12-12 13:27:31 -05:00
Gregory Szorc
7a14eca3ba tests: use absolute_import in tinyproxy
Thus begins a series of adding absolute_import to a bunch of files for
Python 3 compatibility.
2015-12-06 22:20:08 -08:00
Gregory Szorc
32a26751a0 tests: use absolulte_import in test-wireproto.py 2015-12-06 22:02:39 -08:00
Gregory Szorc
6aedf6c7e9 tests: use absolute_import in test-walkrepo 2015-12-06 22:05:19 -08:00
Gregory Szorc
6700f82707 tests: use absolute_import in hgweberror.py 2015-12-06 22:27:53 -08:00
Gregory Szorc
dd5b65b197 tests: use absolute_import in hghave.py 2015-12-06 22:27:18 -08:00
Gregory Szorc
8cca557cf0 tests: use absolute_import for heredoctest.py 2015-12-06 22:26:12 -08:00
Gregory Szorc
df8d1f17a7 tests: use absolute_import in /get-with-headers.py
While I was here, I removed condition code for failure to import json.
This code was necessary to support Python < 2.6, which didn't include
the json module.
2015-12-06 22:25:41 -08:00
Gregory Szorc
a89bad72f6 tests: use absolute_import in generate-working-copy-states.py 2015-12-06 22:23:37 -08:00
Gregory Szorc
eeefc7c496 tests/filterpyflakes: use absolute_import 2015-12-06 22:22:09 -08:00
Gregory Szorc
8b09023a2c tests/fakepatchtime.py: use absolute_import 2015-12-06 22:14:39 -08:00
Gregory Szorc
2e705bc6fe tests/fakedirstatewritetime.py: use absolute_import 2015-12-06 22:13:36 -08:00
Gregory Szorc
f19396fcbe tests/dumbhttp: use absolute_import 2015-12-06 22:12:07 -08:00
Gregory Szorc
80276bbc11 tests/autodiff.py: use absolute_import 2015-12-06 22:10:10 -08:00
Gregory Szorc
430d619ce6 tests/test-ancestor: use absolute_import 2015-12-06 22:07:13 -08:00
Gregory Szorc
61de06ecc1 tests: add test for Python 3 compatibility
Python 3 is inevitable. There have been incremental movements towards
converting the code base to be Python 3 compatible. Unfortunately, we
don't have any tests that look for Python 3 compatibility. This patch
changes that.

We introduce a check-py3-compat.py script whose role is to verify
Python 3 compatibility of the files passed in. We add a test that
calls this script with all .py files from the source checkout.

The script currently only verifies that absolute_import and
print_function are used. These are the low hanging fruits for Python
compatbility. Over time, we can include more checks, including
verifying we're able to load each Python file with Python 3. You
have to start somewhere.

Accepting this patch means that all new .py files must have
absolute_import and print_function (if "print" is used) to avoid
a new warning about Python 3 incompatibility. We've already
converted several files to use absolute_import and print_function
is in the same boat, so I don't think this is such a radical
proposition.
2015-12-06 22:39:12 -08:00