Patchwork [4,of,8,demandimport-py3] check: check modules in hgdemandimport

login
register
mail settings
Submitter Siddharth Agarwal
Date May 21, 2017, 8:47 p.m.
Message ID <55240ad4c7fc14d01256.1495399679@devvm31800.prn1.facebook.com>
Download mbox | patch
Permalink /patch/20805/
State Accepted
Headers show

Comments

Siddharth Agarwal - May 21, 2017, 8:47 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1495399466 25200
#      Sun May 21 13:44:26 2017 -0700
# Node ID 55240ad4c7fc14d01256df4bbae1d5ef9d609cc6
# Parent  3af6014ae4e910c30de7b9ed16ce0e9130ccc270
check: check modules in hgdemandimport

A few places only check modules in mercurial and hgext. Add
hgdemandimport to the list in those places.

Patch

diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py
--- a/contrib/check-py3-compat.py
+++ b/contrib/check-py3-compat.py
@@ -51,9 +51,10 @@  def check_compat_py3(f):
         return
 
     # Try to import the module.
-    # For now we only support mercurial.* and hgext.* modules because figuring
-    # out module paths for things not in a package can be confusing.
-    if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'):
+    # For now we only support modules in packages because figuring out module
+    # paths for things not in a package can be confusing.
+    if (f.startswith(('hgdemandimport/', 'hgext/', 'mercurial/'))
+        and not f.endswith('__init__.py')):
         assert f.endswith('.py')
         name = f.replace('/', '.')[:-3]
         try:
diff --git a/tests/test-check-help.t b/tests/test-check-help.t
--- a/tests/test-check-help.t
+++ b/tests/test-check-help.t
@@ -23,6 +23,6 @@ 
 Check if ":hg:`help TOPIC`" is valid:
 (use "xargs -n1 -t" to see which help commands are executed)
 
-  $ hg files 'glob:{hgext,mercurial}/**/*.py' | sed 's|\\|/|g' \
+  $ hg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' | sed 's|\\|/|g' \
   > | xargs python "$TESTTMP/scanhelptopics.py" \
   > | xargs -n1 hg help > /dev/null
diff --git a/tests/test-check-pylint.t b/tests/test-check-pylint.t
--- a/tests/test-check-pylint.t
+++ b/tests/test-check-pylint.t
@@ -12,7 +12,7 @@  Current checks:
   $ touch $TESTTMP/fakerc
   $ pylint --rcfile=$TESTTMP/fakerc --disable=all \
   >   --enable=W0102 --reports=no \
-  >   mercurial hgext hgext3rd
+  >   mercurial hgdemandimport hgext hgext3rd
    (?)
   ------------------------------------ (?)
   Your code has been rated at 10.00/10 (?)