tests/test-module-imports.t
author Mads Kiilerich <madski@unity3d.com>
Sat, 27 Apr 2013 23:19:52 +0200
changeset 21087 3fb2affb023f
parent 20519 cda9d2b6beab
child 22947 c63a09b6b337
permissions -rw-r--r--
largefiles: make cat on standins do something cat of a standin would silently fail. The use of standins is mostly an implementation detail, but it is already a bit leaking. Being able to see the content of standins might be convenient for debugging.

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

  $ 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' | sed 's-\\-/-g' | xargs python "$import_checker"
  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, templatekw, util
  mercurial/ui.py mixed imports
     stdlib:    formatter
     relative:  config, error, scmutil, util
  Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil -> mercurial.cmdutil