author | Brodie Rao <brodie@sf.io> |
Sun, 17 Nov 2013 18:04:28 -0500 | |
changeset 20178 | 74aea4be8e78 |
parent 20173 | 40f79b9a2cc8 |
child 20199 | d87ed25733a1 |
permissions | -rw-r--r-- |
20059
385e209377a6
test-module-imports: skip on Python < 2.6, since ast is new in 2.6
Augie Fackler <raf@durin42.com>
parents:
20039
diff
changeset
|
1 |
This code uses the ast module, which was new in 2.6, so we'll skip |
385e209377a6
test-module-imports: skip on Python < 2.6, since ast is new in 2.6
Augie Fackler <raf@durin42.com>
parents:
20039
diff
changeset
|
2 |
this test on anything earlier. |
385e209377a6
test-module-imports: skip on Python < 2.6, since ast is new in 2.6
Augie Fackler <raf@durin42.com>
parents:
20039
diff
changeset
|
3 |
$ python -c 'import sys ; assert sys.version_info >= (2, 6)' || exit 80 |
385e209377a6
test-module-imports: skip on Python < 2.6, since ast is new in 2.6
Augie Fackler <raf@durin42.com>
parents:
20039
diff
changeset
|
4 |
|
20173
40f79b9a2cc8
test-module-imports: try and detect virtualenv breakage (issue4129)
Augie Fackler <raf@durin42.com>
parents:
20059
diff
changeset
|
5 |
Virtualenv has a habit of leaving BaseHTTPServer and other modules in |
40f79b9a2cc8
test-module-imports: try and detect virtualenv breakage (issue4129)
Augie Fackler <raf@durin42.com>
parents:
20059
diff
changeset
|
6 |
a place where the import checker is confused about their nature as |
40f79b9a2cc8
test-module-imports: try and detect virtualenv breakage (issue4129)
Augie Fackler <raf@durin42.com>
parents:
20059
diff
changeset
|
7 |
part of the stdlib. Skip the test if BaseHTTPServer's path isn't a |
40f79b9a2cc8
test-module-imports: try and detect virtualenv breakage (issue4129)
Augie Fackler <raf@durin42.com>
parents:
20059
diff
changeset
|
8 |
subpath of sys.prefix. |
40f79b9a2cc8
test-module-imports: try and detect virtualenv breakage (issue4129)
Augie Fackler <raf@durin42.com>
parents:
20059
diff
changeset
|
9 |
|
40f79b9a2cc8
test-module-imports: try and detect virtualenv breakage (issue4129)
Augie Fackler <raf@durin42.com>
parents:
20059
diff
changeset
|
10 |
$ python -c 'import sys, BaseHTTPServer; assert BaseHTTPServer.__file__.startswith(sys.prefix)' || exit 80 |
40f79b9a2cc8
test-module-imports: try and detect virtualenv breakage (issue4129)
Augie Fackler <raf@durin42.com>
parents:
20059
diff
changeset
|
11 |
|
20039
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
12 |
$ import_checker="$TESTDIR"/../contrib/import-checker.py |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
13 |
Run the doctests from the import checker, and make sure |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
14 |
it's working correctly. |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
15 |
$ TERM=dumb |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
16 |
$ export TERM |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
17 |
$ python -m doctest $import_checker |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
18 |
|
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
19 |
$ cd "$TESTDIR"/.. |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
20 |
$ if hg identify -q > /dev/null 2>&1; then : |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
21 |
> else |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
22 |
> echo "skipped: not a Mercurial working dir" >&2 |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
23 |
> exit 80 |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
24 |
> fi |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
25 |
|
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
26 |
There are a handful of cases here that require renaming a module so it |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
27 |
doesn't overlap with a stdlib module name. There are also some cycles |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
28 |
here that we should still endeavor to fix, and some cycles will be |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
29 |
hidden by deduplication algorithm in the cycle detector, so fixing |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
30 |
these may expose other cycles. |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
31 |
|
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
32 |
$ hg locate 'mercurial/**.py' | xargs python "$import_checker" |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
33 |
mercurial/dispatch.py mixed stdlib and relative imports: |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
34 |
commands, error, extensions, fancyopts, hg, hook, util |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
35 |
mercurial/fileset.py mixed stdlib and relative imports: |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
36 |
error, merge, parser, util |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
37 |
mercurial/revset.py mixed stdlib and relative imports: |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
38 |
discovery, error, hbisect, parser, phases, util |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
39 |
mercurial/templater.py mixed stdlib and relative imports: |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
40 |
config, error, parser, templatefilters, util |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
41 |
mercurial/ui.py mixed stdlib and relative imports: |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
42 |
config, error, formatter, scmutil, util |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
43 |
Import cycle: mercurial.cmdutil -> mercurial.subrepo -> mercurial.cmdutil |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
44 |
Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
45 |
Import cycle: mercurial.fileset -> mercurial.merge -> mercurial.subrepo -> mercurial.match -> mercurial.fileset |
05626e87489c
test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff
changeset
|
46 |
Import cycle: mercurial.filemerge -> mercurial.match -> mercurial.fileset -> mercurial.merge -> mercurial.filemerge |