comparison tests/test-module-imports.t @ 20039:05626e87489c

test-module-imports.t: new test to use the import cycle detector
author Augie Fackler <raf@durin42.com>
date Sun, 17 Nov 2013 13:38:35 -0500
parents
children 385e209377a6
comparison
equal deleted inserted replaced
20038:c65a6937b828 20039:05626e87489c
1 $ import_checker="$TESTDIR"/../contrib/import-checker.py
2 Run the doctests from the import checker, and make sure
3 it's working correctly.
4 $ TERM=dumb
5 $ export TERM
6 $ python -m doctest $import_checker
7
8 $ cd "$TESTDIR"/..
9 $ if hg identify -q > /dev/null 2>&1; then :
10 > else
11 > echo "skipped: not a Mercurial working dir" >&2
12 > exit 80
13 > fi
14
15 There are a handful of cases here that require renaming a module so it
16 doesn't overlap with a stdlib module name. There are also some cycles
17 here that we should still endeavor to fix, and some cycles will be
18 hidden by deduplication algorithm in the cycle detector, so fixing
19 these may expose other cycles.
20
21 $ hg locate 'mercurial/**.py' | xargs python "$import_checker"
22 mercurial/dispatch.py mixed stdlib and relative imports:
23 commands, error, extensions, fancyopts, hg, hook, util
24 mercurial/fileset.py mixed stdlib and relative imports:
25 error, merge, parser, util
26 mercurial/revset.py mixed stdlib and relative imports:
27 discovery, error, hbisect, parser, phases, util
28 mercurial/templater.py mixed stdlib and relative imports:
29 config, error, parser, templatefilters, util
30 mercurial/ui.py mixed stdlib and relative imports:
31 config, error, formatter, scmutil, util
32 Import cycle: mercurial.cmdutil -> mercurial.subrepo -> mercurial.cmdutil
33 Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview
34 Import cycle: mercurial.fileset -> mercurial.merge -> mercurial.subrepo -> mercurial.match -> mercurial.fileset
35 Import cycle: mercurial.filemerge -> mercurial.match -> mercurial.fileset -> mercurial.merge -> mercurial.filemerge