Commit 86cda8a2ce68d87675fcf7a05de8fd3feb10359d

Authored by Jürgen Knödlseder
1 parent 804f12ce

Raise an exception instead of exiting with a return code in Python tests (#1983)

test/test_examples.py
... ... @@ -2,7 +2,7 @@
2 2 # ==========================================================================
3 3 # This scripts performs unit tests for the example executables
4 4 #
5   -# Copyright (C) 2016 Juergen Knoedlseder
  5 +# Copyright (C) 2016-2017 Juergen Knoedlseder
6 6 #
7 7 # This program is free software: you can redistribute it and/or modify
8 8 # it under the terms of the GNU General Public License as published by
... ... @@ -266,5 +266,7 @@ if __name__ == '__main__':
266 266 else:
267 267 rc = 1
268 268  
269   - # Exit with return code
270   - sys.exit(rc)
  269 + # Raise an exception in case of failure
  270 + if not success:
  271 + raise RuntimeError('At least one error occured during the test.')
  272 + #sys.exit(rc)
... ...
test/test_python.py
... ... @@ -219,8 +219,10 @@ def test(installed=False):
219 219 if installed:
220 220 os.system('rm -rf %s' % (path))
221 221  
222   - # Exit with return code
223   - sys.exit(rc)
  222 + # Raise an exception in case of failure
  223 + if not success:
  224 + raise RuntimeError('At least one error occured during the test.')
  225 + #sys.exit(rc)
224 226  
225 227  
226 228 # ======================== #
... ...