__author__ = 'Dominic Miglar <dominic.miglar@bitmovin.net>'

import sys
from unittest import TestSuite, TextTestRunner
from . import core
from . import http
from . import encodingprofile
from . import input
from . import output
from . import job
from . import statistics

VERBOSITY_LEVEL = 2

def _collect_test_suites():
    test_suites = []
    test_suites.append(core.get_test_suite())
    test_suites.append(http.get_test_suite())
    test_suites.append(encodingprofile.get_test_suite())
    test_suites.append(input.get_test_suite())
    test_suites.append(output.get_test_suite())
    test_suites.append(job.get_test_suite())
    test_suites.append(statistics.get_test_suite())
    return test_suites

def _run_tests(test_suite):
    return TextTestRunner(verbosity=VERBOSITY_LEVEL).run(test_suite)


def main():
    test_suites = _collect_test_suites()
    main_test_suite = TestSuite()

    test_suite_results = []
    for test_suite in test_suites:
        main_test_suite.addTests(test_suite)
        #test_suite_results.append(_run_tests(test_suite))

    test_suite_results.append(_run_tests(main_test_suite))

if __name__ == '__main__':
    main()

@@ -891,36 +891,8 @@
 ()%0A%0A
-    test_suite_results = %5B%5D%0A
     
@@ -971,17 +971,13 @@
 te)%0A
-    
+%0A
     
-#
 test
@@ -985,33 +985,27 @@
 suite_result
-s.append(
+ = 
 _run_tests(t
@@ -995,32 +995,37 @@
 lt = _run_tests(
+main_
 test_suite))%0A%0A  
@@ -1019,23 +1019,28 @@
 t_suite)
-)%0A
 %0A    
+if not 
 test_sui
@@ -1052,44 +1052,44 @@
 sult
-s.append(_run_tests(main_test_suite)
+.wasSuccessful():%0A        sys.exit(1
 )%0A%0Ai

return exit code 1 when tests are failing -> so travis knows when tests are failing