|
15 | 15 | sys.exit(0)
|
16 | 16 |
|
17 | 17 | n = 1
|
| 18 | +url = None |
18 | 19 | parser = configparser.RawConfigParser()
|
19 | 20 | try:
|
20 | 21 | parser.read(config)
|
|
25 | 26 | else:
|
26 | 27 | print('No test directory specified in your config file. Please do so.')
|
27 | 28 | sys.exit(0)
|
| 29 | + if not parser.has_option('dashboard', 'LOG_DIR'): |
| 30 | + print('No log directory specified in your config file. Please do so.') |
| 31 | + sys.exit(0) |
28 | 32 | if parser.has_option('dashboard', 'SUBMIT_RESULTS_URL'):
|
29 | 33 | url = parser.get('dashboard', 'SUBMIT_RESULTS_URL')
|
30 | 34 | else:
|
31 | 35 | print('No url specified in your config file for submitting test results. Please do so.')
|
32 |
| - sys.exit(0) |
33 |
| -except configparser.Error: |
34 |
| - raise |
| 36 | +except configparser.Error as e: |
| 37 | + print("Something went wrong while parsing the configuration file:\n{}".format(e)) |
35 | 38 |
|
36 | 39 | data = {'test_runs': [], 'grouped_tests': []}
|
37 | 40 | log = open("test_runs.log", "w")
|
|
81 | 84 | data['grouped_tests'].append({'endpoint': h[1], 'test_name': r[2]})
|
82 | 85 | break
|
83 | 86 |
|
84 |
| -# Try to send test results and endpoint and unit tests to the dashboard |
85 |
| -try: |
86 |
| - requests.post(url, json=data) |
87 |
| - print('Sent unit test results to the dashboard.') |
88 |
| -except: |
89 |
| - print('Sending unit test results to the dashboard failed.') |
90 |
| - raise |
| 87 | +# Try to send test results and endpoint-grouped unit tests to the dashboard |
| 88 | +if url: |
| 89 | + try: |
| 90 | + requests.post(url, json=data) |
| 91 | + print('Sent unit test results to the dashboard.') |
| 92 | + except Exception as e: |
| 93 | + print('Sending unit test results to the dashboard failed:\n{}'.format(e)) |
0 commit comments