annotate Lib/test/test_pkg.py @ 80661:94de77bd0b4b 2.7

Issue #16194: document imp.load_dynamic problems when read several extension modules from the same binary object file.
author Andrew Svetlov <andrew.svetlov@gmail.com>
date Thu, 29 Nov 2012 19:51:28 +0200
parents cd8d3c2d3bce
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6247
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 # Test packages (dotted-name import)
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
3 import sys
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
4 import os
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
5 import tempfile
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
6 import textwrap
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
7 import unittest
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
8 from test import test_support
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
9
6247
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
10
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 # Helpers to create and destroy hierarchies.
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
12
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 def cleanout(root):
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 names = os.listdir(root)
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 for name in names:
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6539
diff changeset
16 fullname = os.path.join(root, name)
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6539
diff changeset
17 if os.path.isdir(fullname) and not os.path.islink(fullname):
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6539
diff changeset
18 cleanout(fullname)
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6539
diff changeset
19 else:
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6539
diff changeset
20 os.remove(fullname)
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
21 os.rmdir(root)
6247
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
22
14342
d41c41371dc1 Applying patch #100994 to allow JPython to use more of the standard
Barry Warsaw <barry@python.org>
parents: 14038
diff changeset
23 def fixdir(lst):
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
24 if "__builtins__" in lst:
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
25 lst.remove("__builtins__")
14342
d41c41371dc1 Applying patch #100994 to allow JPython to use more of the standard
Barry Warsaw <barry@python.org>
parents: 14038
diff changeset
26 return lst
d41c41371dc1 Applying patch #100994 to allow JPython to use more of the standard
Barry Warsaw <barry@python.org>
parents: 14038
diff changeset
27
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
28
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
29 # XXX Things to test
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
30 #
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
31 # import package without __init__
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
32 # import package with __init__
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
33 # __init__ importing submodule
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
34 # __init__ importing global module
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
35 # __init__ defining variables
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
36 # submodule importing other submodule
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
37 # submodule importing global module
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
38 # submodule import submodule via global name
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
39 # from package import submodule
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
40 # from package import subpackage
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
41 # from package import variable (defined in __init__)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
42 # from package import * (defined in __init__)
6247
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
43
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
44
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
45 class Test(unittest.TestCase):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
46
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
47 def setUp(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
48 self.root = None
46474
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
49 self.pkgname = None
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
50 self.syspath = list(sys.path)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
51
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
52 def tearDown(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
53 sys.path[:] = self.syspath
59045
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
54 if self.root: # Only clean if the test was actually run
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
55 cleanout(self.root)
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
56
68588
cd8d3c2d3bce #11565: Fix several typos. Patch by Piotr Kasprzyk.
Ezio Melotti <ezio.melotti@gmail.com>
parents: 59045
diff changeset
57 # delete all modules concerning the tested hierarchy
46474
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
58 if self.pkgname:
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
59 modules = [name for name in sys.modules
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
60 if self.pkgname in name.split('.')]
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
61 for name in modules:
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
62 del sys.modules[name]
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
63
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
64 def run_code(self, code):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
65 exec(textwrap.dedent(code), globals(), {"self": self})
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
66
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
67 def mkhier(self, descr):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
68 root = tempfile.mkdtemp()
7747
aedd2d0dcb31 Mass check-in after untabifying all files that need it.
Guido van Rossum <guido@python.org>
parents: 6539
diff changeset
69 sys.path.insert(0, root)
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
70 if not os.path.isdir(root):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
71 os.mkdir(root)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
72 for name, contents in descr:
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
73 comps = name.split()
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
74 fullname = root
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
75 for c in comps:
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
76 fullname = os.path.join(fullname, c)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
77 if contents is None:
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
78 os.mkdir(fullname)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
79 else:
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
80 f = open(fullname, "w")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
81 f.write(contents)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
82 if contents and contents[-1] != '\n':
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
83 f.write('\n')
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
84 f.close()
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
85 self.root = root
46474
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
86 # package name is the name of the first item
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
87 self.pkgname = descr[0][0]
6247
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
88
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
89 def test_1(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
90 hier = [("t1", None), ("t1 __init__"+os.extsep+"py", "")]
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
91 self.mkhier(hier)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
92 import t1
15305
07f24261c6e6 Make reindent.py happy (convert everything to 4-space indents!).
Fred Drake <fdrake@acm.org>
parents: 14342
diff changeset
93
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
94 def test_2(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
95 hier = [
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
96 ("t2", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
97 ("t2 __init__"+os.extsep+"py", "'doc for t2'"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
98 ("t2 sub", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
99 ("t2 sub __init__"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
100 ("t2 sub subsub", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
101 ("t2 sub subsub __init__"+os.extsep+"py", "spam = 1"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
102 ]
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
103 self.mkhier(hier)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
104
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
105 import t2.sub
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
106 import t2.sub.subsub
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
107 self.assertEqual(t2.__name__, "t2")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
108 self.assertEqual(t2.sub.__name__, "t2.sub")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
109 self.assertEqual(t2.sub.subsub.__name__, "t2.sub.subsub")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
110
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
111 # This exec crap is needed because Py3k forbids 'import *' outside
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
112 # of module-scope and __import__() is insufficient for what we need.
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
113 s = """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
114 import t2
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
115 from t2 import *
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
116 self.assertEqual(dir(), ['self', 'sub', 't2'])
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
117 """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
118 self.run_code(s)
15305
07f24261c6e6 Make reindent.py happy (convert everything to 4-space indents!).
Fred Drake <fdrake@acm.org>
parents: 14342
diff changeset
119
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
120 from t2 import sub
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
121 from t2.sub import subsub
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
122 from t2.sub.subsub import spam
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
123 self.assertEqual(sub.__name__, "t2.sub")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
124 self.assertEqual(subsub.__name__, "t2.sub.subsub")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
125 self.assertEqual(sub.subsub.__name__, "t2.sub.subsub")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
126 for name in ['spam', 'sub', 'subsub', 't2']:
55002
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
127 self.assertTrue(locals()["name"], "Failed to import %s" % name)
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
128
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
129 import t2.sub
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
130 import t2.sub.subsub
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
131 self.assertEqual(t2.__name__, "t2")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
132 self.assertEqual(t2.sub.__name__, "t2.sub")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
133 self.assertEqual(t2.sub.subsub.__name__, "t2.sub.subsub")
15305
07f24261c6e6 Make reindent.py happy (convert everything to 4-space indents!).
Fred Drake <fdrake@acm.org>
parents: 14342
diff changeset
134
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
135 s = """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
136 from t2 import *
55002
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
137 self.assertTrue(dir(), ['self', 'sub'])
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
138 """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
139 self.run_code(s)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
140
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
141 def test_3(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
142 hier = [
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
143 ("t3", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
144 ("t3 __init__"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
145 ("t3 sub", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
146 ("t3 sub __init__"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
147 ("t3 sub subsub", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
148 ("t3 sub subsub __init__"+os.extsep+"py", "spam = 1"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
149 ]
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
150 self.mkhier(hier)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
151
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
152 import t3.sub.subsub
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
153 self.assertEqual(t3.__name__, "t3")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
154 self.assertEqual(t3.sub.__name__, "t3.sub")
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
155 self.assertEqual(t3.sub.subsub.__name__, "t3.sub.subsub")
6247
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
156
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
157 def test_4(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
158 hier = [
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
159 ("t4.py", "raise RuntimeError('Shouldnt load t4.py')"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
160 ("t4", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
161 ("t4 __init__"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
162 ("t4 sub.py", "raise RuntimeError('Shouldnt load sub.py')"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
163 ("t4 sub", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
164 ("t4 sub __init__"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
165 ("t4 sub subsub"+os.extsep+"py",
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
166 "raise RuntimeError('Shouldnt load subsub.py')"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
167 ("t4 sub subsub", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
168 ("t4 sub subsub __init__"+os.extsep+"py", "spam = 1"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
169 ]
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
170 self.mkhier(hier)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
171
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
172 s = """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
173 from t4.sub.subsub import *
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
174 self.assertEqual(spam, 1)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
175 """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
176 self.run_code(s)
6247
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
177
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
178 def test_5(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
179 hier = [
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
180 ("t5", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
181 ("t5 __init__"+os.extsep+"py", "import t5.foo"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
182 ("t5 string"+os.extsep+"py", "spam = 1"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
183 ("t5 foo"+os.extsep+"py",
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
184 "from . import string; assert string.spam == 1"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
185 ]
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
186 self.mkhier(hier)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
187
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
188 import t5
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
189 s = """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
190 from t5 import *
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
191 self.assertEqual(dir(), ['foo', 'self', 'string', 't5'])
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
192 """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
193 self.run_code(s)
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
194
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
195 import t5
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
196 self.assertEqual(fixdir(dir(t5)),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
197 ['__doc__', '__file__', '__name__',
44116
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
198 '__package__', '__path__', 'foo', 'string', 't5'])
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
199 self.assertEqual(fixdir(dir(t5.foo)),
44116
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
200 ['__doc__', '__file__', '__name__', '__package__',
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
201 'string'])
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
202 self.assertEqual(fixdir(dir(t5.string)),
44116
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
203 ['__doc__', '__file__', '__name__','__package__',
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
204 'spam'])
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
205
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
206 def test_6(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
207 hier = [
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
208 ("t6", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
209 ("t6 __init__"+os.extsep+"py",
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
210 "__all__ = ['spam', 'ham', 'eggs']"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
211 ("t6 spam"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
212 ("t6 ham"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
213 ("t6 eggs"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
214 ]
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
215 self.mkhier(hier)
15305
07f24261c6e6 Make reindent.py happy (convert everything to 4-space indents!).
Fred Drake <fdrake@acm.org>
parents: 14342
diff changeset
216
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
217 import t6
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
218 self.assertEqual(fixdir(dir(t6)),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
219 ['__all__', '__doc__', '__file__',
44116
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
220 '__name__', '__package__', '__path__'])
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
221 s = """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
222 import t6
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
223 from t6 import *
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
224 self.assertEqual(fixdir(dir(t6)),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
225 ['__all__', '__doc__', '__file__',
44116
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
226 '__name__', '__package__', '__path__',
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
227 'eggs', 'ham', 'spam'])
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
228 self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6'])
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
229 """
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
230 self.run_code(s)
6284
daa62c2264b5 Added test for __all__.
Guido van Rossum <guido@python.org>
parents: 6255
diff changeset
231
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
232 def test_7(self):
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
233 hier = [
46474
5c43159f5ad0 Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents: 45468
diff changeset
234 ("t7", None),
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
235 ("t7"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
236 ("t7 __init__"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
237 ("t7 sub"+os.extsep+"py",
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
238 "raise RuntimeError('Shouldnt load sub.py')"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
239 ("t7 sub", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
240 ("t7 sub __init__"+os.extsep+"py", ""),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
241 ("t7 sub "+os.extsep+"py",
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
242 "raise RuntimeError('Shouldnt load subsub.py')"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
243 ("t7 sub subsub", None),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
244 ("t7 sub subsub __init__"+os.extsep+"py",
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
245 "spam = 1"),
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
246 ]
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
247 self.mkhier(hier)
6247
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
248
1496444e8c8b Test set for package import.
Guido van Rossum <guido@python.org>
parents:
diff changeset
249
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
250 t7, sub, subsub = None, None, None
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
251 import t7 as tas
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
252 self.assertEqual(fixdir(dir(tas)),
44116
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
253 ['__doc__', '__file__', '__name__',
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
254 '__package__', '__path__'])
55002
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
255 self.assertFalse(t7)
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
256 from t7 import sub as subpar
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
257 self.assertEqual(fixdir(dir(subpar)),
44116
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
258 ['__doc__', '__file__', '__name__',
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
259 '__package__', '__path__'])
55002
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
260 self.assertFalse(t7)
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
261 self.assertFalse(sub)
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
262 from t7.sub import subsub as subsubsub
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
263 self.assertEqual(fixdir(dir(subsubsub)),
44116
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
264 ['__doc__', '__file__', '__name__',
803edf9b1dd9 Implement PEP 366
Nick Coghlan <ncoghlan@gmail.com>
parents: 42789
diff changeset
265 '__package__', '__path__', 'spam'])
55002
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
266 self.assertFalse(t7)
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
267 self.assertFalse(sub)
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
268 self.assertFalse(subsub)
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
269 from t7.sub.subsub import spam as ham
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
270 self.assertEqual(ham, 1)
55002
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
271 self.assertFalse(t7)
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
272 self.assertFalse(sub)
6768b2350c57 convert usage of fail* to assert*
Benjamin Peterson <benjamin@python.org>
parents: 46474
diff changeset
273 self.assertFalse(subsub)
6255
f446e08ac302 Fix details in the test:
Guido van Rossum <guido@python.org>
parents: 6251
diff changeset
274
59045
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
275 @unittest.skipIf(sys.flags.optimize >= 2,
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
276 "Docstrings are omitted with -O2 and above")
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
277 def test_8(self):
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
278 hier = [
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
279 ("t8", None),
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
280 ("t8 __init__"+os.extsep+"py", "'doc for t8'"),
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
281 ]
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
282 self.mkhier(hier)
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
283
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
284 import t8
a4c45f8e70aa Issue 6292: for the moment at least, the test suite passes if run
R. David Murray <rdmurray@bitdance.com>
parents: 55002
diff changeset
285 self.assertEqual(t8.__doc__, "doc for t8")
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
286
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
287 def test_main():
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
288 test_support.run_unittest(__name__)
8375
242b3c9c5bec Test that "import sys.imp" fails as it should.
Guido van Rossum <guido@python.org>
parents: 7747
diff changeset
289
42789
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
290
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
291 if __name__ == "__main__":
721c3ea13d84 Convert test_pkg to use unittest.
Collin Winter <collinw@gmail.com>
parents: 24816
diff changeset
292 test_main()