Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Why

Integration tests emit deprecation warnings from dulwich 0.22.9:

DeprecationWarning: checkout_branch is deprecated since 0.22.9 and will be removed in 0.24.0

Goal: eliminate warning by migrating to current dulwich API.

What changed

  • Replace porcelain.checkout_branch(repo, branch.encode("utf-8")) with porcelain.checkout(repo=repo, target=branch) in infrahub_sdk/testing/repository.py
  • No behavior change: checkout() performs identical operation with cleaner signature (handles string/bytes transparently)

How to review

Single-line change in GitRepo.init(). Old API took encoded bytes; new API accepts strings directly.

How to test

Run integration test that triggered the warning:

pytest tests/integration/test_repository.py::TestInfrahubRepository::test_add_repository -v

No deprecation warning should appear.

Impact & rollout

  • Backward compatibility: None - internal testing utility only
  • Performance: No change
  • Deployment notes: Safe to deploy

Checklist

  • Tests added/updated
  • Changelog entry added (uv run towncrier create ...)
  • External docs updated (if user-facing or ops-facing change)
  • Internal .md docs updated (internal knowledge and AI code tools knowledge)
Original prompt

This section details on the original issue you should resolve

<issue_title>task: Deprecation warning in CI with branch checkout</issue_title>
<issue_description>### Component

No response

Task Description

Running the integration tests shows this warning:

tests/integration/test_repository.py::TestInfrahubRepository::test_add_repository
  /var/lib/github/ghrunner_2/infrahub-sdk-python/infrahub-sdk-python/infrahub_sdk/testing/repository.py:76: DeprecationWarning: checkout_branch is deprecated since 0.22.9 and will be removed in 0.24.0
    porcelain.checkout_branch(self._repo.git, self.initial_branch.encode("utf-8"))
```</issue_description>

<agent_instructions>Review what changes needs to be done based on the code within the third party package. </agent_instructions>

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

<comments>
</comments>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: ogenstad <6694669+ogenstad@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 11, 2026

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2ae03cb
Status: ✅  Deploy successful!
Preview URL: https://a74efaec.infrahub-sdk-python.pages.dev
Branch Preview URL: https://copilot-fix-deprecation-warn.infrahub-sdk-python.pages.dev

View logs

Copilot AI changed the title [WIP] Fix deprecation warning in CI with branch checkout Fix dulwich checkout_branch deprecation warning in testing utilities Feb 11, 2026
Copilot AI requested a review from ogenstad February 11, 2026 07:36
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##           stable     #819      +/-   ##
==========================================
- Coverage   80.37%   80.34%   -0.04%     
==========================================
  Files         115      115              
  Lines        9873     9873              
  Branches     1504     1504              
==========================================
- Hits         7935     7932       -3     
- Misses       1416     1420       +4     
+ Partials      522      521       -1     
Flag Coverage Δ
integration-tests 41.41% <100.00%> (-0.04%) ⬇️
python-3.10 51.40% <100.00%> (ø)
python-3.11 51.40% <100.00%> (ø)
python-3.12 51.38% <100.00%> (-0.03%) ⬇️
python-3.13 51.40% <100.00%> (ø)
python-3.14 53.03% <100.00%> (-0.03%) ⬇️
python-filler-3.12 24.06% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/testing/repository.py 77.77% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

task: Deprecation warning in CI with branch checkout

2 participants