Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 53 lines (45 sloc) 1.41 kb
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 44 45 46 47 48 49 50 51 52 53
#!/usr/bin/python

import os
import re
import shutil
import sys
import tempfile
import time
import unittest

from clienttests import ClientConfigTests
from sitetests import SiteConfigTests
from arbtests import ArbitratorConfigTests

if __name__ == '__main__':
    if os.geteuid() == 0:
        sys.stderr.write("Must be run non-root; aborting.\n")
        sys.exit(1)

    tmp_path = '/tmp/booth-tests'
    if not os.path.exists(tmp_path):
        os.makedirs(tmp_path)
    test_run_path = tempfile.mkdtemp(prefix='%d.' % time.time(), dir=tmp_path)

    suite = unittest.TestSuite()
    testclasses = [
        SiteConfigTests,
        #ArbitratorConfigTests,
        ClientConfigTests,
    ]
    for testclass in testclasses:
        testclass.test_run_path = test_run_path
        suite.addTests(unittest.TestLoader().loadTestsFromTestCase(testclass))

    runner_args = {
        #'verbosity' : 2,
    }
    major, minor, micro, releaselevel, serial = sys.version_info
    if major > 2 or (major == 2 and minor >= 7):
        # New in 2.7
        runner_args['buffer'] = True
        runner_args['failfast'] = True
        pass

    runner = unittest.TextTestRunner(**runner_args)
    result = runner.run(suite)

    if result.wasSuccessful():
        shutil.rmtree(test_run_path)
        sys.exit(0)
    else:
        print "Left %s for debugging" % test_run_path
        sys.exit(1)
Something went wrong with that request. Please try again.