Skip to content

Add tests and CI support for automatic testing for Python scripts#832

Merged
pickypg merged 5 commits intoelastic:mainfrom
valeriy42:python-tests
May 8, 2025
Merged

Add tests and CI support for automatic testing for Python scripts#832
pickypg merged 5 commits intoelastic:mainfrom
valeriy42:python-tests

Conversation

@valeriy42
Copy link
Copy Markdown
Collaborator

This PR adds unit tests for scripts and automatic PR testing with GitHub workflow. This will ensure that automatic dependency updates will not break the behaviour.

@valeriy42 valeriy42 requested a review from pickypg as a code owner May 5, 2025 07:54
@valeriy42 valeriy42 requested review from Copilot and removed request for pickypg May 5, 2025 07:54
@valeriy42 valeriy42 self-assigned this May 5, 2025
Copy link
Copy Markdown

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.

Pull Request Overview

This PR introduces new unit tests for both importing and exporting model snapshots and adds CI support (via GitHub workflows and nox) for automated testing.

  • Added comprehensive tests covering functions such as sanitization, extraction, archive handling, and Elasticsearch interactions.
  • Updated project configurations (pyproject.toml, noxfile.py) and added a GitHub Actions workflow to run tests on pull requests.

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/share_ad_job_state/tests/test_import_model_snapshot.py New tests for import functionality including file extraction and ES operations.
scripts/share_ad_job_state/tests/test_export_model_snapshot.py New tests for export functionality covering archive creation and ES data retrieval.
scripts/share_ad_job_state/pyproject.toml Updated configuration; added development dependencies.
scripts/share_ad_job_state/noxfile.py Added nox sessions for formatting, linting, and testing.
scripts/share_ad_job_state/import_model_snapshot.py Minor reordering of imports; no functional changes.
scripts/share_ad_job_state/export_model_snapshot.py Minor formatting improvements for argument parsing.
.github/workflows/python-tests.yml Added CI workflow for running tests on pull requests.
Files not reviewed (1)
  • scripts/share_ad_job_state/.gitignore: Language not supported
Comments suppressed due to low confidence (1)

scripts/share_ad_job_state/tests/test_import_model_snapshot.py:99

  • [nitpick] Consider using a standard hyphen ('-') for index names to maintain consistency and avoid potential issues with non‐standard characters, unless the special character is intentional.
actions = list(ims.generate_actions(str(f), "new‑idx"))

@valeriy42
Copy link
Copy Markdown
Collaborator Author

@pickypg can you please give it a review?

@pickypg pickypg merged commit 2ec1a94 into elastic:main May 8, 2025
5 checks passed
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.

3 participants