Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move functions from test_applications_from_config.py to simtools.testing #1238

Merged
merged 14 commits into from
Nov 20, 2024

Conversation

GernotMaier
Copy link
Contributor

@GernotMaier GernotMaier commented Nov 14, 2024

The integration test application test_applications_from_config.py contains rather complicated functions to prepare, run, and validate the integration tests.

This PR moves:

  • all methods to corresponding modules in the simtools.testing area
  • new modules are testing.configuration and testing.helpers
  • renamed the module testing.compare_output to testing.validate_output
  • added unit tests for all modules

Side note: needed to move the pytest package from the test section to the general in pyproject toml, as some of modules in simtools.testing are importing pytest.

I suggest not to do a line-by-line code review, but review the general refactoring and naming. No new functionality has been added, but code moved around. Also not sure if we need a line-by-line review of units tests.

Closes #1174

@GernotMaier GernotMaier self-assigned this Nov 14, 2024

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@GernotMaier GernotMaier marked this pull request as ready for review November 15, 2024 10:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 12 changed files in this pull request and generated 1 suggestion.

Files not reviewed (6)
  • tests/unit_tests/testing/test_compare_output.py: Evaluated as low risk
  • .github/workflows/CI-schema-validation.yml: Evaluated as low risk
  • tests/integration_tests/test_applications_from_config.py: Evaluated as low risk
  • pyproject.toml: Evaluated as low risk
  • docs/source/api-reference/testing.md: Evaluated as low risk
  • docs/changes/1238.maintenance.md: Evaluated as low risk
Comments skipped due to low confidence (2)

simtools/testing/helpers.py:12

  • [nitpick] The error message is too verbose. Consider making it more concise, e.g., 'Skipping due to old testeff version. Update sim_telarray tarball.'
pytest.skip("Any applications calling the old version of testeff are skipped due to a limitation of the old testeff not allowing to specify the include directory. Please update your sim_telarray tarball.")

simtools/testing/helpers.py:21

pytest.skip("The test simtools-validate-camera-efficiency_SSTS is skipped since the fake SST mirrors are not yet implemented (#1155)")

simtools/testing/helpers.py Outdated Show resolved Hide resolved

This comment has been minimized.

This comment has been minimized.


def _prepare_configuration(config, output_path, model_version=None):
"""
Prepare test configuration.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming and desciption is very similar to above function configuration. Suggest to rename it and also to clarify what configuration string means in the docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed it to _prepare_test_options. Improved also the docstring.

]
)

if get_test_names:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to always return both, to avoid calling it twice in test_application_from_config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I've changed the logic accordingly.

Copy link
Collaborator

@tobiaskleiner tobiaskleiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GernotMaier thanks for the PR! The changes look good overall, I have added few minor comments.

Copy link

Passed

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 100.00% Coverage (93.20% Estimated after merge)
  • Duplications 0.00% Duplicated Code (0.00% Estimated after merge)

Project ID: gammasim_simtools_AY_ssha9WiFxsX-2oy_w

View in SonarQube

@GernotMaier
Copy link
Contributor Author

@tobiaskleiner - I think I've addressed your suggestions. Let me know if there is anything else I can do.

Thanks for the review!

Copy link
Collaborator

@tobiaskleiner tobiaskleiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change @GernotMaier, looks good now!

@GernotMaier GernotMaier merged commit d986dcf into main Nov 20, 2024
13 checks passed
@GernotMaier GernotMaier deleted the tests-for-applications branch November 20, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move functions from test_applications_from_config.py to simtools.testing
2 participants