Skip to content

Remove calls to sys.exit from Python functions

Boris Basic requested to merge remove-sys-exit into main

Reference issue

Fix #1040 (closed)

Description

As explained in #1040 (closed), calls to sys.exit in Python functions might prevent their use in other modules. There are a few cases, especially, where calling the main function of cli modules would be an improvement over starting them through the use of subprocess.

As a result of these changes, main functions from cli scripts now return a status code, which is passed to sys.exit for modules called as scripts, that is under the if __name__ == "__main__" statement.

Checklist

All Merge Requests:

  • Update NEWS.txt to describe your changes.
  • Run compile_telemac.py --check-code to check FORTRAN coding conventions.
  • Run pylint to check Python coding conventions.
  • If you added new files, run compile_telemac.py --clean --rescan and commit the updated cmdf file(s) accordingly.
  • Run compile_telemac.py --clean for both normal and debug configurations.
  • Run validate_telemac.py for both normal and debug configurations.
  • Run validate_telemac.py --notebook for both normal and debug configurations.
  • Run doc_telemac.py if there are any modifications in the documentation.
  • Run damocles.py --eficas if there are any modifications in the dictionaries.

Additionnaly, for a new feature:

  • Check that your feature works in both serial and parallel modes.
  • Add at least one test case to check the functionality (with documentation, graphics and VnV script)
  • Update the documentation for the module in which your feature will be available.

Merge request reports

Loading