changeset 28965:98153441c8cc

py3: make check-seclevel use absolute_import Also fixed direct symbol imports even the tests were not complaining.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 17 Apr 2016 00:14:42 +0530
parents 9dcc9ed26d33
children ea1fab5293ca
files doc/check-seclevel.py tests/test-check-py3-compat.t
diffstat 2 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/doc/check-seclevel.py	Thu Apr 14 15:20:11 2016 +0000
+++ b/doc/check-seclevel.py	Sun Apr 17 00:14:42 2016 +0530
@@ -2,18 +2,26 @@
 #
 # checkseclevel - checking section title levels in each online help document
 
-import sys, os
+from __future__ import absolute_import
+
 import optparse
+import os
+import sys
 
 # import from the live mercurial repo
 os.environ['HGMODULEPOLICY'] = 'py'
 sys.path.insert(0, "..")
 from mercurial import demandimport; demandimport.enable()
-from mercurial.commands import table
-from mercurial.help import helptable
-from mercurial import extensions
-from mercurial import minirst
-from mercurial import ui as uimod
+from mercurial import (
+    commands,
+    extensions,
+    help,
+    minirst,
+    ui as uimod,
+)
+
+table = commands.table
+helptable = help.helptable
 
 level2mark = ['"', '=', '-', '.', '#']
 reservedmarks = ['"']
--- a/tests/test-check-py3-compat.t	Thu Apr 14 15:20:11 2016 +0000
+++ b/tests/test-check-py3-compat.t	Sun Apr 17 00:14:42 2016 +0530
@@ -3,7 +3,6 @@
   $ cd "$TESTDIR"/..
 
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
-  doc/check-seclevel.py not using absolute_import
   doc/gendoc.py not using absolute_import
   doc/hgmanpage.py not using absolute_import
   hgext/color.py not using absolute_import