annotate tests/test-module-imports.t @ 24722:02a5618e2fbf

revset: don't import discovery at module level discovery.py imports a lot of the world. Pierre-Yves told me to move it to a function-level import to avoid an import cycle in a future patch.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 14 Apr 2015 12:54:16 -0400
parents 642d245ff537
children d71492ca2fdd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23894
f388ceae2250 test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents: 22947
diff changeset
1 #require test-repo
f388ceae2250 test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents: 22947
diff changeset
2
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
3 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
4 this test on anything earlier.
22947
c63a09b6b337 tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents: 20519
diff changeset
5 $ $PYTHON -c 'import sys ; assert sys.version_info >= (2, 6)' || exit 80
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
6
20039
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
7 $ import_checker="$TESTDIR"/../contrib/import-checker.py
23894
f388ceae2250 test-module-imports: use test-repo requirement
Matt Mackall <mpm@selenic.com>
parents: 22947
diff changeset
8
20039
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
9 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
10 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
11 $ TERM=dumb
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
12 $ export TERM
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
13 $ 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
14
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
15 $ cd "$TESTDIR"/..
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
16
05626e87489c test-module-imports.t: new test to use the import cycle detector
Augie Fackler <raf@durin42.com>
parents:
diff changeset
17 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
18 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
19 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
20 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
21 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
22
20395
ab71fb058ebf tests: test-module-imports.t works on windows (with backslash path sep)
Simon Heimberg <simohe@besonet.ch>
parents: 20392
diff changeset
23 $ hg locate 'mercurial/**.py' | sed 's-\\-/-g' | xargs python "$import_checker"
24423
01b39e821d00 crecord: conditionalize the imports that are not available on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 23894
diff changeset
24 mercurial/crecord.py mixed imports
01b39e821d00 crecord: conditionalize the imports that are not available on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 23894
diff changeset
25 stdlib: fcntl, termios
01b39e821d00 crecord: conditionalize the imports that are not available on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 23894
diff changeset
26 relative: curses
20386
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
27 mercurial/dispatch.py mixed imports
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
28 stdlib: commands
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
29 relative: error, extensions, fancyopts, hg, hook, util
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
30 mercurial/fileset.py mixed imports
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
31 stdlib: parser
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
32 relative: error, merge, util
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
33 mercurial/revset.py mixed imports
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
34 stdlib: parser
24722
02a5618e2fbf revset: don't import discovery at module level
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24487
diff changeset
35 relative: error, hbisect, phases, util
20386
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
36 mercurial/templater.py mixed imports
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
37 stdlib: parser
20519
cda9d2b6beab template: add revset() template function
Durham Goode <durham@fb.com>
parents: 20405
diff changeset
38 relative: config, error, templatefilters, templatekw, util
20386
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
39 mercurial/ui.py mixed imports
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
40 stdlib: formatter
a05d31b040d7 import-checker: show stdlib and relative imports separately
Mads Kiilerich <madski@unity3d.com>
parents: 20199
diff changeset
41 relative: config, error, scmutil, util
24487
642d245ff537 import-checker: fix rotatecycle
Matt Mackall <mpm@selenic.com>
parents: 24423
diff changeset
42 Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil