Skip to content

Add comprehensive Pytest unit test suite and increase coverage after master sync for MAIA toolkit#77

Draft
Copilot wants to merge 14 commits into
masterfrom
copilot/create-unittests-with-pytest
Draft

Add comprehensive Pytest unit test suite and increase coverage after master sync for MAIA toolkit#77
Copilot wants to merge 14 commits into
masterfrom
copilot/create-unittests-with-pytest

Conversation

Copilot AI commented Oct 23, 2025

Copy link
Copy Markdown
Contributor
  • Run pytest tests/test_* --cov=MAIA --cov=MAIA_scripts to identify lowest-covered areas
  • Add focused unit tests for uncovered helper paths in low-coverage modules
  • Run targeted pytest for new test files
  • Re-run full requested coverage command and lint test files
  • Commit and push coverage improvements
Original prompt

This section details on the original issue you should resolve

<issue_title>Create UnitTests with Pytest for all classes, functions, and scripts under MAIA/ and MAIA_scripts</issue_title>
<issue_description>## Objective
Develop comprehensive unit tests using Pytest for all classes, functions, and scripts located in both the MAIA/ and MAIA_scripts/ directories.

Tasks

  • Identify all classes and functions in MAIA/ and MAIA_scripts/
  • Write Pytest-based unit tests for each class and function
  • Ensure coverage for edge cases and expected failures
  • Add tests for the main execution paths within scripts
  • Document all tests clearly

Acceptance Criteria

  • All code in MAIA/ and MAIA_scripts/ is covered by Pytest unit tests
  • Tests are easy to run locally and in CI
  • Tests can be executed with pytest
  • PR includes documentation or comments for new tests

Additional Notes

  • Use best practices for Pytest structure and assertions
  • If any functionality is hard to test, document the reasons
    </issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #75


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


📚 Documentation preview 📚: https://MAIA--77.org.readthedocs.build/en/77/

Copilot AI and others added 3 commits October 23, 2025 15:30
…ules

Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>
Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>
…unction coverage

Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>
Copilot AI changed the title [WIP] Add unit tests with Pytest for MAIA and MAIA_scripts Add comprehensive Pytest unit test suite with 127 tests for MAIA toolkit Oct 23, 2025
…bility logic in dashboard_utils.py

- Added new dependencies including flake8, black, and pytest to setup.cfg for improved code quality and testing.
- Refactored GPU availability checking logic in dashboard_utils.py to enhance readability and efficiency by using list comprehensions.
- Updated test cases in test_dashboard_utils.py to reflect changes in GPU availability logic and ensure accurate assertions for overlapping bookings.
- Introduced a new script, tag.sh, to automate the process of retrieving the latest Git tag and incrementing version numbers based on specified bump types (major, minor, patch) and optional prerelease tags.
- The script includes validation for version formats and handles both normal and prerelease versioning, ensuring proper tagging and pushing of new versions to the remote repository.
- Added echo statements for user feedback during the tagging process.
Signed-off-by: Simone Bendazzoli <simben@kth.se>
@SimoneBendazzoli93

Copy link
Copy Markdown
Collaborator

@copilot pull again from master and recheck the pytests for new function classes

… modules

Agent-Logs-Url: https://github.com/minnelab/MAIA/sessions/f9db2288-48c1-4f2c-907f-ef8ba3133536

Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>

Copilot AI commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot pull again from master and recheck the pytests for new function classes

Done. I pulled/rebased against the latest master, rechecked tests for newly added functions/classes, updated parser tests to match current CLI signatures, and added new coverage in tests/test_new_function_classes.py for new modules/scripts from master. Addressed in commit a25615b.

Copilot AI changed the title Add comprehensive Pytest unit test suite with 127 tests for MAIA toolkit Add comprehensive Pytest unit test suite and sync coverage with latest master for MAIA toolkit May 16, 2026
@SimoneBendazzoli93

Copy link
Copy Markdown
Collaborator

@copilot Recheck all other previously created tests ( for example maia_core maia_admin and maia_fn) since the code has significantly changed. Also run lint for tests

Agent-Logs-Url: https://github.com/minnelab/MAIA/sessions/bdf0097b-d1dc-420e-b38f-3b598bc42f80

Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>
Copilot stopped work on behalf of SimoneBendazzoli93 due to an error May 16, 2026 08:36
… lint pass

Agent-Logs-Url: https://github.com/minnelab/MAIA/sessions/1e6889ed-3e3d-4508-bb2d-7fe229f32f11

Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>
@SimoneBendazzoli93

Copy link
Copy Markdown
Collaborator

@copilot add more tests or integrate the existing one to increase the pytest coverage

…eycloak unit tests

Agent-Logs-Url: https://github.com/minnelab/MAIA/sessions/0be86981-086c-4b53-9ead-eb3e4e608b86

Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>

Copilot AI commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot add more tests or integrate the existing one to increase the pytest coverage

Added more coverage by integrating new tests for MAIA_scripts/MAIA_deploy_project.py helpers and extending tests/test_keycloak_utils.py with additional helper-path tests. Verified with python -m pytest tests/test_*.py -q (143 passed) and python -m flake8 tests/conftest.py tests/test_*.py (clean). Addressed in commit 628ee3f.

Copilot AI changed the title Add comprehensive Pytest unit test suite and sync coverage with latest master for MAIA toolkit Add comprehensive Pytest unit test suite and increase coverage after master sync for MAIA toolkit May 16, 2026
Copilot AI and others added 2 commits May 16, 2026 15:18
Agent-Logs-Url: https://github.com/minnelab/MAIA/sessions/0375b650-2b54-45b4-8623-095674c4752f

Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>
Agent-Logs-Url: https://github.com/minnelab/MAIA/sessions/0375b650-2b54-45b4-8623-095674c4752f

Co-authored-by: SimoneBendazzoli93 <25175838+SimoneBendazzoli93@users.noreply.github.com>
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.

Create UnitTests with Pytest for all classes, functions, and scripts under MAIA/ and MAIA_scripts

2 participants