Skip to content

Conversation

@simonkurtz-MSFT
Copy link
Member

@simonkurtz-MSFT simonkurtz-MSFT commented May 23, 2025

  • Adds an initial set of Python unit tests for the shared Python modules.
  • Updates the GitHub Python tests workflow to ensure passing tests.

@simonkurtz-MSFT simonkurtz-MSFT requested a review from Copilot May 23, 2025 11:03
@simonkurtz-MSFT simonkurtz-MSFT self-assigned this May 23, 2025
@simonkurtz-MSFT simonkurtz-MSFT added documentation Improvements or additions to documentation enhancement New feature or request labels May 23, 2025
Copy link

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

Adds comprehensive Python testing infrastructure and updates the JSON extraction behavior in utilities

  • Introduces new pytest suites for utils.py, apimtypes.py, and apimrequests.py
  • Configures pytest markers, fixtures, coverage scripts, CI workflow, and documentation
  • Adjusts extract_json to 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_json returns None when the input is not a string, covering the isinstance(text, str) early-exit branch.
def test_extract_json_none():

@github-actions
Copy link

github-actions bot commented May 23, 2025

Python 3.13 Test Results

78 tests   78 ✅  0s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit f0d281e.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented May 23, 2025

Python 3.12 Test Results

78 tests   78 ✅  1s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit f0d281e.

♻️ This comment has been updated with latest results.

@Azure-Samples Azure-Samples deleted a comment from github-actions bot May 23, 2025
@Azure-Samples Azure-Samples deleted a comment from github-actions bot May 23, 2025
@simonkurtz-MSFT simonkurtz-MSFT requested a review from Copilot May 23, 2025 15:26
Copy link

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 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

@simonkurtz-MSFT simonkurtz-MSFT merged commit 4313838 into main May 23, 2025
7 checks passed
@simonkurtz-MSFT simonkurtz-MSFT deleted the feature/add-python-tests branch May 23, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants