Skip to content

Increase code test coverage, adjust release pipeline#6

Closed
devinslick wants to merge 2 commits intomainfrom
increase-code-test-coverage
Closed

Increase code test coverage, adjust release pipeline#6
devinslick wants to merge 2 commits intomainfrom
increase-code-test-coverage

Conversation

@devinslick
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings November 6, 2025 18:13
@devinslick devinslick closed this Nov 6, 2025
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
fmd_api/client.py 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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 improves code quality and test coverage through formatting standardization, tooling updates, and comprehensive test additions.

  • Version bumped from 2.0.2 to 2.0.3
  • Added pre-commit hooks configuration for automated code quality checks
  • Reformatted test file using Black formatter for consistency
  • Updated GitHub Actions workflow to publish to TestPyPI on pull requests

Reviewed Changes

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

Show a summary per file
File Description
tests/unit/test_coverage_improvements.py Applied Black formatting (line wrapping, spacing, quote consistency) throughout the test file
pyproject.toml Version bump to 2.0.3 and added pre-commit to dev dependencies
fmd_api/_version.py Version string updated to match pyproject.toml
fmd_api/client.py Minor formatting improvements (line wrapping)
.pre-commit-config.yaml Added new pre-commit configuration with Black, flake8, mypy, and file cleanup hooks
.github/workflows/publish.yml Modified workflow to publish to TestPyPI on PRs and PyPI on main branch pushes
docs/*.md Trailing whitespace removed from documentation files
.gitignore Trailing newline added

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

Comment on lines +47 to +53
# Publish from pull requests to main -> TestPyPI
publish_testpypi:
name: Publish to TestPyPI (branches except main)
name: Publish to TestPyPI (PR to main)
runs-on: ubuntu-latest
needs: build_sdist_and_wheel
# Only run for pushes (not releases) and only for branches that are NOT main
if: |
github.event_name == 'push' &&
startsWith(github.ref, 'refs/heads/') &&
github.ref != 'refs/heads/main'
# Only run for pull request events targeting main
if: github.event_name == 'pull_request' && github.base_ref == 'main'
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Publishing to TestPyPI on every pull request to main could create issues:

  1. Version conflicts: Multiple PRs will try to publish the same version (2.0.3), causing failures after the first PR
  2. Unnecessary builds: This will publish packages for PRs that might not be merged
  3. The skip-existing: true parameter on line 71 only partially addresses this

Consider one of these alternatives:

  • Only publish to TestPyPI on manual workflow dispatch or specific labels
  • Use unique version suffixes for PR builds (e.g., 2.0.3.dev{pr_number})
  • Remove PR publishing entirely and only publish from main/releases

Copilot uses AI. Check for mistakes.
assert "pictures/manifest.json" in files
assert any("picture_" in f and f.endswith(".png") for f in files)

import os
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move import os to the top-level imports section.

Copilot uses AI. Check for mistakes.

try:
import tempfile
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move import tempfile to the top-level imports section.

Copilot uses AI. Check for mistakes.
await client.export_data_zip(output_path, include_pictures=True)

# Should complete despite error
import zipfile
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move import zipfile to the top-level imports section.

Copilot uses AI. Check for mistakes.

try:
import tempfile
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move import tempfile to the top-level imports section.

Copilot uses AI. Check for mistakes.
Comment on lines 982 to 983
import tempfile
import zipfile
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move both import tempfile and import zipfile to the top-level imports section.

Copilot uses AI. Check for mistakes.

try:
import tempfile
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move import tempfile to the top-level imports section (around line 6-19). This applies to multiple test functions in this file.

Copilot uses AI. Check for mistakes.

# Verify ZIP contains PNG
import zipfile
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move import zipfile to the top-level imports section.

Copilot uses AI. Check for mistakes.
assert "error" in manifest[0]

import os
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move import os to the top-level imports section.

Copilot uses AI. Check for mistakes.
assert any(".jpg" in name for name in names)

# Cleanup
import os
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

Imports should be placed at the top of the file, not within function bodies. Move import os to the top-level imports section.

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.

3 participants