Debian Codegraph @

tests/test_all.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2012-2013 Vinay Sajip.
4 # Licensed to the Python Software Foundation under a contributor agreement.
5 # See LICENSE.txt and CONTRIBUTORS.txt.
6 #
7 import logging
8 import os
9 import sys
10
11 from compat import unittest
12
13 # Always find our sources first
14 sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
15 import distlib_tests
16
17 sys.path.pop(0)
18
19
20 def main():
21 verbosity = 1
22 if '-v' in sys.argv:
23 verbosity = 2
24 loader = unittest.TestLoader()
25 failfast = 'FAILFAST' in os.environ
26 runner = unittest.TextTestRunner(verbosity=verbosity, failfast=failfast)
27 results = runner.run(loader.loadTestsFromModule(distlib_tests))
28 return not results.wasSuccessful()
29
30
31 if __name__ == '__main__':
32 here = os.path.dirname(os.path.abspath(__file__))
33 rundir = os.path.join(here, 'run')
34 if not os.path.exists(rundir):
35 os.mkdir(rundir)
36 elif not os.path.isdir(rundir):
37 raise ValueError('Not a directory: %r' % rundir)
38 fn = os.path.join(rundir, 'test_all_%d.%d.log' % sys.version_info[:2])
39 logging.basicConfig(level=logging.DEBUG,
40 filename=fn,
41 filemode='w',
42 format='%(levelname)-8s %(name)-20s %(message)s')
43 sys.exit(main())