~malept/ubuntu/lucid/python2.6/dev-dependency-fix

« back to all changes in this revision

Viewing changes to Lib/lib2to3/tests/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-02-13 12:51:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090213125100-uufgcb9yeqzujpqw
Tags: upstream-2.6.1
ImportĀ upstreamĀ versionĀ 2.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""Make tests/ into a package. This allows us to "import tests" and
 
2
have tests.all_tests be a TestSuite representing all test cases
 
3
from all test_*.py files in tests/."""
 
4
# Author: Collin Winter
 
5
 
 
6
import os
 
7
import os.path
 
8
import unittest
 
9
import types
 
10
 
 
11
from . import support
 
12
 
 
13
all_tests = unittest.TestSuite()
 
14
 
 
15
tests_dir = os.path.join(os.path.dirname(__file__), '..', 'tests')
 
16
tests = [t[0:-3] for t in os.listdir(tests_dir)
 
17
                        if t.startswith('test_') and t.endswith('.py')]
 
18
 
 
19
loader = unittest.TestLoader()
 
20
 
 
21
for t in tests:
 
22
    __import__("",globals(),locals(),[t],level=1)
 
23
    mod = globals()[t]
 
24
    all_tests.addTests(loader.loadTestsFromModule(mod))