##// END OF EJS Templates
import-checker: show stdlib and relative imports separately...
import-checker: show stdlib and relative imports separately Make the output more useful for debugging problems.

File last commit:

r20386:a05d31b0 default
r20386:a05d31b0 default
Show More
test-module-imports.t
44 lines | 1.8 KiB | text/troff | Tads3Lexer
/ tests / test-module-imports.t
Augie Fackler
test-module-imports: skip on Python < 2.6, since ast is new in 2.6
r20059 This code uses the ast module, which was new in 2.6, so we'll skip
this test on anything earlier.
$ python -c 'import sys ; assert sys.version_info >= (2, 6)' || exit 80
Augie Fackler
test-module-imports.t: new test to use the import cycle detector
r20039 $ 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, and some cycles will be
hidden by deduplication algorithm in the cycle detector, so fixing
these may expose other cycles.
$ hg locate 'mercurial/**.py' | xargs python "$import_checker"
Mads Kiilerich
import-checker: show stdlib and relative imports separately...
r20386 mercurial/dispatch.py mixed imports
stdlib: commands
relative: error, extensions, fancyopts, hg, hook, util
mercurial/fileset.py mixed imports
stdlib: parser
relative: error, merge, util
mercurial/revset.py mixed imports
stdlib: parser
relative: discovery, error, hbisect, phases, util
mercurial/templater.py mixed imports
stdlib: parser
relative: config, error, templatefilters, util
mercurial/ui.py mixed imports
stdlib: formatter
relative: config, error, scmutil, util
Augie Fackler
test-module-imports.t: new test to use the import cycle detector
r20039 Import cycle: mercurial.cmdutil -> mercurial.subrepo -> mercurial.cmdutil
Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview
Import cycle: mercurial.fileset -> mercurial.merge -> mercurial.subrepo -> mercurial.match -> mercurial.fileset
Import cycle: mercurial.filemerge -> mercurial.match -> mercurial.fileset -> mercurial.merge -> mercurial.filemerge