view tests/test-module-imports.t @ 25063:723e364488f4

import-checker: add xargs like mode Before this patch, "import-check.py" is invoked via "xargs" in "test-module-imports.t", but it doesn't ensure that "import-checker.py" is certainly invoked with all mercurial specific files at once. "xargs" may invoke specified command multiple times with part of arguments given from stdin: according to "xargs(1)" man page, this dividing arguments is system-dependent. This patch adds "xargs" like mode to "import-checker.py". This can ensure that "import-checker.py" is certainly invoked with all mercurial specific files at once in "test-module-imports.t". This is assumed by subsequent patches.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 14 May 2015 01:49:10 +0900
parents d71492ca2fdd
children 86298718b01c
line wrap: on
line source

#require test-repo

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"/..

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' | 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:  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