Skip to content

Added automated sanity checks of lalinference python code

Description

This PR builds upon @hong-qi's work in !491 (closed) by adding two generic python test modules in the new /test/ base directory:

  • /test/test_python_imports.py - detects and creates tests to import <module> for all python module files in a subpackage
  • /test/test_python_scripts.py - detects and creates test to <script> --help for all python scripts in a subpackage

These have then been symlinked into /lalinference/test/python/, and are now run during make check. A few scripts cannot be automatically checked for the following reasons:

  • dependence on lalapps
  • dependence on scikit-learn

These are listed in the /lalinference/test/python/exclude-scripts.txt file. Similarly a few modules are listed in exclude-modules.txt because they aren't actually distributed (and I don't know how to detect that automatically).

The new automated checks highlighted a few issues, which I have also fixed, mainly python3 syntax things, as well as #178 (closed).

The generic nature of the new test scripts means that we can enable them for all sub-packages, which I will do in separate MRs once this is merged.

API Changes and Justification

Backwards Compatible Changes

  • This change introduces no API changes
  • This change adds new API calls

Backwards Incompatible Changes

  • This change modifies an existing API
  • This change removes an existing API

Review Status

N/A

Merge request reports