annotate Lib/distutils/tests/__init__.py @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents 6270946115d0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32353
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
1 """Test suite for distutils.
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
2
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
3 This test suite consists of a collection of test modules in the
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
4 distutils.tests package. Each test module has a name starting with
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
5 'test' and contains a function test_suite(). The function is expected
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
6 to return an initialized unittest.TestSuite instance.
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
7
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
8 Tests for the command classes in the distutils.command package are
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
9 included in distutils.tests as well, instead of using a separate
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
10 distutils.command.tests package, since command identification is done
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
11 by import rather than matching pre-defined names.
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
12
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
13 """
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
14
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
15 import os
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
16 import sys
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
17 import unittest
67854
6270946115d0 Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents: 32353
diff changeset
18 from test.test_support import run_unittest
32353
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
19
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
20
67854
6270946115d0 Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents: 32353
diff changeset
21 here = os.path.dirname(__file__) or os.curdir
32353
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
22
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
23
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
24 def test_suite():
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
25 suite = unittest.TestSuite()
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
26 for fn in os.listdir(here):
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
27 if fn.startswith("test") and fn.endswith(".py"):
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
28 modname = "distutils.tests." + fn[:-3]
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
29 __import__(modname)
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
30 module = sys.modules[modname]
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
31 suite.addTest(module.test_suite())
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
32 return suite
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
33
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
34
40acb68ad224 One unit test for distutils is not much, but is more than we had yesterday.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
35 if __name__ == "__main__":
67854
6270946115d0 Merged revisions 86236,86240,86332,86340,87271,87273,87447 via svnmerge from
Éric Araujo <merwok@netwok.org>
parents: 32353
diff changeset
36 run_unittest(test_suite())