#!/usr/bin/python

__author__ = 'Elisabetta Ronchieri'

import sys
import unittest
import getopt

from tstorm.utils import report_file 
from tstorm.utils import settings

from tstorm.utils import sequence
from tstorm.utils import release
from tstorm.utils import range
from tstorm.utils import limit
from tstorm.utils import test
from tstorm.utils import tests
from tstorm.utils import filters
from tstorm.utils import configuration

from tstorm.run import run_tests

if __name__ == '__main__':
    try:
        rt = run_tests.RunTests()
        rt.do_parse()
        rt.do_pre_run()
        rt.do_list()
        rt.do_run_tests()
    except sequence.SequenceError, err:
        print '\n\nExecution: ', err
    except filters.FiltersError, err:
        print '\n\nExecution: ', err
    except run_tests.OptionError, err:
        print '\n\nExecution: ', err
    except tests.TestsError, err:
        print '\n\nExecution: ', err
    except run_tests.RunTestsError, err:
        print '\n\nExecution: ', err
    except range.RangeError, err:
        print '\n\nExecution: ', err
    except limit.LimitError, err:
        print '\n\nExecution: ', err
    except release.ReleaseError, err:
        print '\n\nExecution: ', err
    except test.TestStructureError, err:
        print '\n\nExecution: ', err
    except KeyboardInterrupt:
        print '\n\nExecution n!'
        sys.exit(1)
