D5294: tests: make test-check-module-imports more robust

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Thu Nov 22 08:33:41 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdd028bca9221: tests: make test-check-module-imports more robust (authored by valentin.gatienbaron, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5294?vs=12581&id=12584

REVISION DETAIL
  https://phab.mercurial-scm.org/D5294

AFFECTED FILES
  contrib/import-checker.py

CHANGE DETAILS

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -260,10 +260,12 @@
                 break
         else:
             stdlib_prefixes.add(dirname)
+    sourceroot = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
     for libpath in sys.path:
-        # We want to walk everything in sys.path that starts with
-        # something in stdlib_prefixes.
-        if not any(libpath.startswith(p) for p in stdlib_prefixes):
+        # We want to walk everything in sys.path that starts with something in
+        # stdlib_prefixes, but not directories from the hg sources.
+        if (os.path.abspath(libpath).startswith(sourceroot)
+            or not any(libpath.startswith(p) for p in stdlib_prefixes)):
             continue
         for top, dirs, files in os.walk(libpath):
             for i, d in reversed(list(enumerate(dirs))):



To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list