Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_modulefinder.py @ 78069:a8aa77458e12 3.2
Add c_size_t and c_ssize_t to the ctypes summary table.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Thu, 12 Jul 2012 20:31:50 +0200 |
| parents | 4d5f0c4487eb |
| children | 1521d9837d16 |
| rev | line source |
|---|---|
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 import __future__ |
|
45471
7dd2c1746267
Merged revisions 60990-61002 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
40949
diff
changeset
|
2 import os |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 import unittest |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 import distutils.dir_util |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 import tempfile |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 |
|
47201
9c930a32cebb
#2621 rename test.test_support to test.support
Benjamin Peterson <benjamin@python.org>
parents:
45471
diff
changeset
|
7 from test import support |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 import modulefinder |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 TEST_DIR = tempfile.mkdtemp() |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 TEST_PATH = [TEST_DIR, os.path.dirname(__future__.__file__)] |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 # Each test description is a list of 5 items: |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 # |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 # 1. a module name that will be imported by modulefinder |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 # 2. a list of module names that modulefinder is required to find |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 # 3. a list of module names that modulefinder should complain |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 # about because they are not found |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 # 4. a list of module names that modulefinder should complain |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 # about because they MAY be not found |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 # 5. a string specifying packages to create; the format is obvious imo. |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 # |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 # Each package will be created in TEST_DIR, and TEST_DIR will be |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 # removed after the tests again. |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 # Modulefinder searches in a path that contains TEST_DIR, plus |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 # the standard Lib directory. |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 maybe_test = [ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 "a.module", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 ["a", "a.module", "sys", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 "b"], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 ["c"], ["b.something"], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 """\ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 a/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 a/module.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 from b import something |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 from c import something |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 b/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 from sys import * |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 """] |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 maybe_test_new = [ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 "a.module", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 ["a", "a.module", "sys", |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
40214
diff
changeset
|
46 "b", "__future__"], |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 ["c"], ["b.something"], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 """\ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 a/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 a/module.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 from b import something |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 from c import something |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 b/__init__.py |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
40214
diff
changeset
|
54 from __future__ import absolute_import |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 from sys import * |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 """] |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 package_test = [ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 "a.module", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 ["a", "a.b", "a.c", "a.module", "mymodule", "sys"], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 ["blahblah", "c"], [], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 """\ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
63 mymodule.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 a/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 import blahblah |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
66 from a import b |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 import c |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
68 a/module.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 import sys |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 from a import b as x |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 from a.c import sillyname |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 a/b.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 a/c.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
74 from a.module import x |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 import mymodule as sillyname |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
76 from sys import version_info |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 """] |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
79 absolute_import_test = [ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
80 "a.module", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 ["a", "a.module", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 "b", "b.x", "b.y", "b.z", |
|
40949
e759fd8d95ae
Remove the exceptions builtin module, all the exceptions are already builtin.
Neal Norwitz <nnorwitz@gmail.com>
parents:
40450
diff
changeset
|
83 "__future__", "sys", "gc"], |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
84 ["blahblah", "z"], [], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 """\ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
86 mymodule.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
87 a/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
88 a/module.py |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
40214
diff
changeset
|
89 from __future__ import absolute_import |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
90 import sys # sys |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 import blahblah # fails |
|
40949
e759fd8d95ae
Remove the exceptions builtin module, all the exceptions are already builtin.
Neal Norwitz <nnorwitz@gmail.com>
parents:
40450
diff
changeset
|
92 import gc # gc |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
93 import b.x # b.x |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
94 from b import y # b.y |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 from b.z import * # b.z.* |
|
40949
e759fd8d95ae
Remove the exceptions builtin module, all the exceptions are already builtin.
Neal Norwitz <nnorwitz@gmail.com>
parents:
40450
diff
changeset
|
96 a/gc.py |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 a/sys.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 import mymodule |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 a/b/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
100 a/b/x.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 a/b/y.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
102 a/b/z.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
103 b/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 import z |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 b/unused.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
106 b/x.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
107 b/y.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
108 b/z.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
109 """] |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
110 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
111 relative_import_test = [ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
112 "a.module", |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
40214
diff
changeset
|
113 ["__future__", |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
40214
diff
changeset
|
114 "a", "a.module", |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
115 "a.b", "a.b.y", "a.b.z", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
116 "a.b.c", "a.b.c.moduleC", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
117 "a.b.c.d", "a.b.c.e", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
118 "a.b.x", |
|
40949
e759fd8d95ae
Remove the exceptions builtin module, all the exceptions are already builtin.
Neal Norwitz <nnorwitz@gmail.com>
parents:
40450
diff
changeset
|
119 "gc"], |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
120 [], [], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
121 """\ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
122 mymodule.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
123 a/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
124 from .b import y, z # a.b.y, a.b.z |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
125 a/module.py |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
40214
diff
changeset
|
126 from __future__ import absolute_import # __future__ |
|
40949
e759fd8d95ae
Remove the exceptions builtin module, all the exceptions are already builtin.
Neal Norwitz <nnorwitz@gmail.com>
parents:
40450
diff
changeset
|
127 import gc # gc |
|
e759fd8d95ae
Remove the exceptions builtin module, all the exceptions are already builtin.
Neal Norwitz <nnorwitz@gmail.com>
parents:
40450
diff
changeset
|
128 a/gc.py |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
129 a/sys.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
130 a/b/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
131 from ..b import x # a.b.x |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
132 #from a.b.c import moduleC |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
133 from .c import moduleC # a.b.moduleC |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
134 a/b/x.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
135 a/b/y.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
136 a/b/z.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
137 a/b/g.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
138 a/b/c/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 from ..c import e # a.b.c.e |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
140 a/b/c/moduleC.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
141 from ..c import d # a.b.c.d |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
142 a/b/c/d.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
143 a/b/c/e.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
144 a/b/c/x.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
145 """] |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
146 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
147 relative_import_test_2 = [ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
148 "a.module", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
149 ["a", "a.module", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
150 "a.sys", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
151 "a.b", "a.b.y", "a.b.z", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
152 "a.b.c", "a.b.c.d", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
153 "a.b.c.e", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
154 "a.b.c.moduleC", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
155 "a.b.c.f", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 "a.b.x", |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
157 "a.another"], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
158 [], [], |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
159 """\ |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
160 mymodule.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
161 a/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
162 from . import sys # a.sys |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
163 a/another.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
164 a/module.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
165 from .b import y, z # a.b.y, a.b.z |
|
40949
e759fd8d95ae
Remove the exceptions builtin module, all the exceptions are already builtin.
Neal Norwitz <nnorwitz@gmail.com>
parents:
40450
diff
changeset
|
166 a/gc.py |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 a/sys.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
168 a/b/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
169 from .c import moduleC # a.b.c.moduleC |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
170 from .c import d # a.b.c.d |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
171 a/b/x.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
172 a/b/y.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
173 a/b/z.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
174 a/b/c/__init__.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
175 from . import e # a.b.c.e |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
176 a/b/c/moduleC.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
177 # |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
178 from . import f # a.b.c.f |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
179 from .. import x # a.b.x |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
180 from ... import another # a.another |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
181 a/b/c/d.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
182 a/b/c/e.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
183 a/b/c/f.py |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
184 """] |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
185 |
|
49633
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
186 relative_import_test_3 = [ |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
187 "a.module", |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
188 ["a", "a.module"], |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
189 ["a.bar"], |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
190 [], |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
191 """\ |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
192 a/__init__.py |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
193 def foo(): pass |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
194 a/module.py |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
195 from . import foo |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
196 from . import bar |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
197 """] |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
198 |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
199 def open_file(path): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
200 ##print "#", os.path.abspath(path) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
201 dirname = os.path.dirname(path) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
202 distutils.dir_util.mkpath(dirname) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
203 return open(path, "w") |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
204 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
205 def create_package(source): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
206 ofi = None |
|
65337
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
207 try: |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
208 for line in source.splitlines(): |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
209 if line.startswith(" ") or line.startswith("\t"): |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
210 ofi.write(line.strip() + "\n") |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
211 else: |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
212 if ofi: |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
213 ofi.close() |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
214 ofi = open_file(os.path.join(TEST_DIR, line.strip())) |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
215 finally: |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
216 if ofi: |
|
4d5f0c4487eb
More proper closing of files
Antoine Pitrou <solipsis@pitrou.net>
parents:
55593
diff
changeset
|
217 ofi.close() |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
218 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
219 class ModuleFinderTest(unittest.TestCase): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
220 def _do_test(self, info, report=False): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
221 import_this, modules, missing, maybe_missing, source = info |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
222 create_package(source) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
223 try: |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
224 mf = modulefinder.ModuleFinder(path=TEST_PATH) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
225 mf.import_hook(import_this) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
226 if report: |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
227 mf.report() |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
228 ## # This wouldn't work in general when executed several times: |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
229 ## opath = sys.path[:] |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
230 ## sys.path = TEST_PATH |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
231 ## try: |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
232 ## __import__(import_this) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
233 ## except: |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
234 ## import traceback; traceback.print_exc() |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
235 ## sys.path = opath |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
236 ## return |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
237 modules = set(modules) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
238 found = set(mf.modules.keys()) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
239 more = list(found - modules) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
240 less = list(modules - found) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
241 # check if we found what we expected, not more, not less |
|
55593
0bb232078b8c
Merged revisions 73715 via svnmerge from
Georg Brandl <georg@python.org>
parents:
54379
diff
changeset
|
242 self.assertEqual((more, less), ([], [])) |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
243 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
244 # check for missing and maybe missing modules |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
245 bad, maybe = mf.any_missing_maybe() |
|
55593
0bb232078b8c
Merged revisions 73715 via svnmerge from
Georg Brandl <georg@python.org>
parents:
54379
diff
changeset
|
246 self.assertEqual(bad, missing) |
|
0bb232078b8c
Merged revisions 73715 via svnmerge from
Georg Brandl <georg@python.org>
parents:
54379
diff
changeset
|
247 self.assertEqual(maybe, maybe_missing) |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
248 finally: |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
249 distutils.dir_util.remove_tree(TEST_DIR) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
250 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
251 def test_package(self): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
252 self._do_test(package_test) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
253 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
254 def test_maybe(self): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
255 self._do_test(maybe_test) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
256 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
257 if getattr(__future__, "absolute_import", None): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
258 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
259 def test_maybe_new(self): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
260 self._do_test(maybe_test_new) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
261 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
262 def test_absolute_imports(self): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
263 self._do_test(absolute_import_test) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
264 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
265 def test_relative_imports(self): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
266 self._do_test(relative_import_test) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
267 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
268 def test_relative_imports_2(self): |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
269 self._do_test(relative_import_test_2) |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
270 |
|
49633
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
271 def test_relative_imports_3(self): |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
272 self._do_test(relative_import_test_3) |
|
bd0e9a9cd283
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
Benjamin Peterson <benjamin@python.org>
parents:
47201
diff
changeset
|
273 |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
274 def test_main(): |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
40214
diff
changeset
|
275 distutils.log.set_threshold(distutils.log.WARN) |
|
47201
9c930a32cebb
#2621 rename test.test_support to test.support
Benjamin Peterson <benjamin@python.org>
parents:
45471
diff
changeset
|
276 support.run_unittest(ModuleFinderTest) |
|
40214
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
277 |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
278 if __name__ == "__main__": |
|
d0bd8a8afb01
Thomas Heller fixed modulefinder and added a test. Thanks!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
279 unittest.main() |
