File: test_all.py

package info (click to toggle)
distlib 0.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,252 kB
  • ctags: 3,019
  • sloc: python: 21,062; ansic: 407; sh: 17; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (2)
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
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import logging
import os
import shutil
import sys

from compat import unittest

# Always find our sources first
sys.path.insert(0, '..')
import distlib_tests
sys.path.pop(0)

def main():
    verbosity = 1
    if '-v' in sys.argv:
        verbosity = 2
    loader = unittest.TestLoader()
    runner = unittest.TextTestRunner(verbosity=verbosity)
    results = runner.run(loader.loadTestsFromModule(distlib_tests))
    return not results.wasSuccessful()

if __name__ == '__main__':
    here = os.path.dirname(os.path.abspath(__file__))
    rundir = os.path.join(here, 'run')
    if not os.path.exists(rundir):
        os.mkdir(rundir)
    elif not os.path.isdir(rundir):
        raise ValueError('Not a directory: %r' % rundir)
    fn = os.path.join(rundir, 'test_all_%d.%d.log' % sys.version_info[:2])
    logging.basicConfig(level=logging.DEBUG, filename=fn, filemode='w',
                        format='%(levelname)-8s %(name)-20s %(message)s')
    sys.exit(main())