-
Notifications
You must be signed in to change notification settings - Fork 14
Feature/add python tests #2
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds comprehensive Python testing infrastructure and updates the JSON extraction behavior in utilities
- Introduces new pytest suites for
utils.py,apimtypes.py, andapimrequests.py - Configures pytest markers, fixtures, coverage scripts, CI workflow, and documentation
- Adjusts
extract_jsonto return native Python objects rather than strings
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/python/test_utils.py | New unit tests for JSON validation and resource-group helpers |
| tests/python/test_apimtypes.py | Unit tests for the API data model |
| tests/python/test_apimrequests.py | HTTP-focused tests for ApimRequests methods |
| tests/python/run_coverage.sh/.ps1 | Shell and PowerShell scripts to run pytest with coverage |
| tests/python/pytest.ini | Registers custom pytest markers and paths |
| tests/python/conftest.py | Adds shared fixtures and adjusts PYTHONPATH |
| shared/python/utils.py | Change extract_json to return parsed objects |
| README.md | Updates Testing & Code Coverage section |
| .github/workflows/python-tests.yml | Switches CI to pytest+pytest-cov and uploads coverage HTML |
Comments suppressed due to low confidence (1)
tests/python/test_utils.py:40
- [nitpick] Consider adding a test case to verify that
extract_jsonreturnsNonewhen the input is not a string, covering theisinstance(text, str)early-exit branch.
def test_extract_json_none():
Python 3.13 Test Results78 tests 78 ✅ 0s ⏱️ Results for commit f0d281e. ♻️ This comment has been updated with latest results. |
Python 3.12 Test Results78 tests 78 ✅ 1s ⏱️ Results for commit f0d281e. ♻️ This comment has been updated with latest results. |
There was a problem hiding this 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 an initial set of Python unit tests for the shared Python modules and updates the GitHub Python tests workflow to ensure that tests pass and code coverage is reported. Key changes include:
- Adding comprehensive unit tests for functions in utils.py, apimtypes.py, and apimrequests.py.
- Updating cleanup methods in utils.py to use a private helper (_cleanup_resources) and providing public methods (cleanup_infra_deployments and cleanup_deployment).
- Enhancing CI/CD workflows and documentation (README.md and GitHub Actions workflows) for running tests with coverage.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/python/* | New unit tests covering various utility, API types, and APIM requests functionalities |
| shared/python/utils.py | Refactored cleanup functions and updated JSON extraction logic |
| shared/python/apimtypes.py | Added HTTP_VERB validation within APIOperation’s constructor |
| infrastructure/* | Updated clean-up notebooks to use the new cleanup methods and parameter names |
| .github/workflows/python-tests.yml | Enhanced workflow to support multiple Python versions and artifact uploads |
| README.md | Updated testing and coverage instructions |
Uh oh!
There was an error while loading. Please reload this page.