Patchwork [7,of,7] test-module-imports.t: new test to use the import cycle detector

login
register
mail settings
Submitter Augie Fackler
Date Nov. 17, 2013, 5:21 p.m.
Message ID <c4ea2a5136e11a3adfa8.1384708889@hit-nxdomain.opendns.com>
Download mbox | patch
Permalink /patch/3022/
State Superseded
Commit 05626e87489ce6514b911eaf647586119a5563d0
Headers show

Comments

Augie Fackler - Nov. 17, 2013, 5:21 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1384708046 18000
#      Sun Nov 17 12:07:26 2013 -0500
# Node ID c4ea2a5136e11a3adfa8b5ff66b946e317bb27ec
# Parent  7e27291dba6422ca546a8c4656e3c0f7f94c97d0
test-module-imports.t: new test to use the import cycle detector

Patch

diff --git a/tests/test-module-imports.t b/tests/test-module-imports.t
new file mode 100644
--- /dev/null
+++ b/tests/test-module-imports.t
@@ -0,0 +1,34 @@ 
+  $ import_checker="$TESTDIR"/../contrib/import-checker.py
+Run the doctests from the import checker, and make sure
+it's working correctly.
+  $ TERM=dumb
+  $ export TERM
+  $ python -m doctest $import_checker
+
+  $ cd "$TESTDIR"/..
+  $ if hg identify -q > /dev/null 2>&1; then :
+  > else
+  >     echo "skipped: not a Mercurial working dir" >&2
+  >     exit 80
+  > fi
+
+There are a handful of cases here that require renaming a module so it
+doesn't overlap with a stdlib module name. There are also some cycles
+here that we should still endeavor to fix.
+
+  $ hg locate 'mercurial/**.py' | xargs python "$import_checker"
+  mercurial/dispatch.py mixed stdlib and relative imports:
+     commands, error, extensions, fancyopts, hg, hook, util
+  mercurial/fileset.py mixed stdlib and relative imports:
+     error, merge, parser, util
+  mercurial/revset.py mixed stdlib and relative imports:
+     discovery, error, hbisect, parser, phases, util
+  mercurial/templater.py mixed stdlib and relative imports:
+     config, error, parser, templatefilters, util
+  mercurial/ui.py mixed stdlib and relative imports:
+     config, error, formatter, scmutil, util
+  Import cycle: mercurial.fileset -> mercurial.match -> mercurial.fileset
+  Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview
+  Import cycle: mercurial.filemerge -> mercurial.match -> mercurial.fileset -> mercurial.merge -> mercurial.filemerge
+  Import cycle: mercurial.cmdutil -> mercurial.match -> mercurial.fileset -> mercurial.merge -> mercurial.subrepo -> mercurial.cmdutil
+  Import cycle: mercurial.bundlerepo -> mercurial.cmdutil -> mercurial.patch -> mercurial.scmutil -> mercurial.revset -> mercurial.hg -> mercurial.bundlerepo