Skip to content

Conversation

Copy link

Copilot AI commented Nov 16, 2025

Addressed maintenance tasks: updated dependency versions, added comprehensive test coverage, and corrected typos in project descriptions.

Dependencies Updated

  • Pre-commit hooks: v4.5.0v5.0.0
  • GitHub Actions setup-python: v5.3.0v5.3.1

Tests Added

Created 8 unit tests covering both az_bicep_build and az_bicep_format functions:

  • No files found scenarios
  • Successful operations
  • Error handling and exit codes
  • Multiple file processing

Tests use mocking to avoid external dependencies and run via standard unittest discovery.

Descriptions Fixed

  • Enhanced setup.py description with specific functionality details
  • Added long_description sourced from README.md
  • Fixed typo: "innstall" → "install" in README.md

All changes are backwards compatible and pass security scans.

Original prompt

update dependecies add tests, update descitpionts


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: JanuszNowak <5168275+JanuszNowak@users.noreply.github.com>
@sonarqubecloud
Copy link

Copilot AI changed the title [WIP] Update dependencies and add tests to the project Update dependencies, add unit tests, and fix descriptions Nov 16, 2025
Copilot AI requested a review from JanuszNowak November 16, 2025 13:01
Copilot finished work on behalf of JanuszNowak November 16, 2025 13:01
@JanuszNowak JanuszNowak marked this pull request as ready for review November 16, 2025 13:03
Copilot AI review requested due to automatic review settings November 16, 2025 13:03
Copilot finished reviewing on behalf of JanuszNowak November 16, 2025 13:05
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 addresses technical debt by updating dependencies, adding comprehensive unit test coverage, and fixing documentation issues. The changes are backward compatible and improve code quality.

  • Updated pre-commit hooks (v4.5.0 → v5.0.0) and GitHub Actions setup-python (v5.3.0 → v5.3.1)
  • Added 8 new unit tests covering both az_bicep_build and az_bicep_format functions
  • Fixed typo in README.md and enhanced setup.py descriptions

Reviewed Changes

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

Show a summary per file
File Description
tests/test_az_bicep_build.py New unit tests for bicep build function covering no files, success, errors, and multiple files scenarios
tests/test_az_bicep_format.py New unit tests for bicep format function covering no files, success, errors, and multiple files scenarios
setup.py Removed unnecessary f-string, added long_description from README.md, and enhanced package description
README.md Fixed typo: "innstall" → "install"
.pre-commit-config.yaml Updated pre-commit hooks version from v4.5.0 to v5.0.0
.github/workflows/github-action-ci.yml Updated setup-python action from v5.3.0 to v5.3.1

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

def test_bicep_format_no_files(self, mock_glob, mock_run):
"""Test bicep format when no bicep files are found."""
mock_glob.return_value = []
mock_run.return_value = MagicMock(stdout="Bicep CLI version 0.4.1008", stderr=b"")
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The mock for the version check incorrectly uses stderr=b"" (bytes). Since the actual subprocess.run call uses text=True, stderr should be an empty string "" instead of bytes b"".

Copilot uses AI. Check for mistakes.

# Mock version and format calls (no upgrade because --noupgrade is hardcoded)
mock_run.side_effect = [
MagicMock(stdout="Bicep CLI version 0.4.1008", stderr=b""),
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The mock for the version check in the side_effect list incorrectly uses stderr=b"" (bytes). Since the actual subprocess.run call uses text=True, stderr should be an empty string "" instead of bytes b"".

Copilot uses AI. Check for mistakes.

# Mock version and failed format (no upgrade because --noupgrade is hardcoded)
mock_run.side_effect = [
MagicMock(stdout="Bicep CLI version 0.4.1008", stderr=b""),
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The mock for the version check in the side_effect list incorrectly uses stderr=b"" (bytes). Since the actual subprocess.run call uses text=True, stderr should be an empty string "" instead of bytes b"".

Copilot uses AI. Check for mistakes.

# Mock version and two successful formats (no upgrade because --noupgrade is hardcoded)
mock_run.side_effect = [
MagicMock(stdout="Bicep CLI version 0.4.1008", stderr=b""),
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The mock for the version check in the side_effect list incorrectly uses stderr=b"" (bytes). Since the actual subprocess.run call uses text=True, stderr should be an empty string "" instead of bytes b"".

Copilot uses AI. Check for mistakes.
def test_bicep_build_no_files(self, mock_glob, mock_run):
"""Test bicep build when no bicep files are found."""
mock_glob.return_value = []
mock_run.return_value = MagicMock(stdout="Bicep CLI version 0.4.1008", stderr=b"")
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The mock for the version check incorrectly uses stderr=b"" (bytes). Since the actual subprocess.run call uses text=True, stderr should be an empty string "" instead of bytes b"".

Copilot uses AI. Check for mistakes.

# Mock version and build calls (no upgrade because -noupgrade is hardcoded)
mock_run.side_effect = [
MagicMock(stdout="Bicep CLI version 0.4.1008", stderr=b""),
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The mock for the version check in the side_effect list incorrectly uses stderr=b"" (bytes). Since the actual subprocess.run call uses text=True, stderr should be an empty string "" instead of bytes b"".

Copilot uses AI. Check for mistakes.

# Mock version and failed build (no upgrade because -noupgrade is hardcoded)
mock_run.side_effect = [
MagicMock(stdout="Bicep CLI version 0.4.1008", stderr=b""),
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The mock for the version check in the side_effect list incorrectly uses stderr=b"" (bytes). Since the actual subprocess.run call uses text=True, stderr should be an empty string "" instead of bytes b"".

Copilot uses AI. Check for mistakes.

# Mock version and two successful builds (no upgrade because -noupgrade is hardcoded)
mock_run.side_effect = [
MagicMock(stdout="Bicep CLI version 0.4.1008", stderr=b""),
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The mock for the version check in the side_effect list incorrectly uses stderr=b"" (bytes). Since the actual subprocess.run call uses text=True, stderr should be an empty string "" instead of bytes b"".

Copilot uses AI. Check for mistakes.
#!/usr/bin/env python
"""Unit tests for az_bicep_build function."""
import unittest
import sys
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

Import of 'sys' is not used.

Suggested change
import sys

Copilot uses AI. Check for mistakes.
#!/usr/bin/env python
"""Unit tests for az_bicep_format function."""
import unittest
import sys
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

Import of 'sys' is not used.

Suggested change
import sys

Copilot uses AI. Check for mistakes.
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.

2 participants