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 39 40 41 42 43
|
# -*- 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 sys
from compat import unittest
# Always find our sources first
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import distlib_tests
sys.path.pop(0)
def main():
verbosity = 1
if '-v' in sys.argv:
verbosity = 2
loader = unittest.TestLoader()
failfast = 'FAILFAST' in os.environ
runner = unittest.TextTestRunner(verbosity=verbosity, failfast=failfast)
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())
|