File: __main__.py

package info (click to toggle)
python3.2 3.2.3-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 62,476 kB
  • sloc: python: 344,518; ansic: 315,782; sh: 11,910; asm: 10,846; makefile: 3,564; objc: 775; cpp: 432; exp: 416; xml: 73
file content (29 lines) | stat: -rw-r--r-- 779 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Run importlib's test suite.

Specifying the ``--builtin`` flag will run tests, where applicable, with
builtins.__import__ instead of importlib.__import__.

"""
import importlib
from importlib.test.import_ import util
import os.path
from test.support import run_unittest
import sys
import unittest


def test_main():
    if '__pycache__' in __file__:
        parts = __file__.split(os.path.sep)
        start_dir = sep.join(parts[:-2])
    else:
        start_dir = os.path.dirname(__file__)
    top_dir = os.path.dirname(os.path.dirname(start_dir))
    test_loader = unittest.TestLoader()
    if '--builtin' in sys.argv:
        util.using___import__ = True
    run_unittest(test_loader.discover(start_dir, top_level_dir=top_dir))


if __name__ == '__main__':
    test_main()