Skip to content
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

fix: pass dev selection to sync on pdm add and remove #3415

Closed
wants to merge 4 commits into from

Conversation

huxuan
Copy link
Contributor

@huxuan huxuan commented Mar 8, 2025

Pull Request Checklist

  • A news fragment is added in news/ describing what is new.
  • Test cases added for changed code.

Describe what you have changed in this PR.

A trial fix to #3404.

Actually, I am not sure whether this is the desired approach to fix. Any comments are welcome.

@huxuan huxuan changed the title Xuan.hu/remove sync dev fix: pass dev selection to sync on removing Mar 8, 2025
Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.23%. Comparing base (564d09a) to head (12498bd).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3415   +/-   ##
=======================================
  Coverage   85.23%   85.23%           
=======================================
  Files         112      112           
  Lines       11486    11486           
  Branches     2516     2516           
=======================================
  Hits         9790     9790           
  Misses       1171     1171           
  Partials      525      525           
Flag Coverage Δ
unittests 85.03% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@frostming
Copy link
Collaborator

LGTM, pdm add seems also suffer from the same issue, can you change it too?

@huxuan huxuan changed the title fix: pass dev selection to sync on removing fix: pass dev selection to sync on adding and removing Mar 11, 2025
@huxuan huxuan changed the title fix: pass dev selection to sync on adding and removing fix: pass dev selection to sync on pdm add and remove Mar 11, 2025
@@ -174,7 +174,7 @@ def do_add(
if sync:
do_sync(
project,
selection=GroupSelection(project, groups=[group], default=False),
selection=GroupSelection(project, groups=[group], dev=selection.dev, default=False),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oops, that fails a test case, when the group is a dev group but --dev is not passed explicitly. I guess it's not the correct way to fix, neither for pdm remove.

I think you should fix the _translated_groups() function, so that when dev groups don't exist in the lock file they won't be added to the group_set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha, I will take a look later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can use a set intersection to exclude the non-exist groups

@huxuan huxuan marked this pull request as draft March 11, 2025 02:36
@huxuan
Copy link
Contributor Author

huxuan commented Mar 11, 2025

Deprecated due to #3420

@huxuan huxuan closed this Mar 11, 2025
@huxuan huxuan deleted the xuan.hu/remove-sync-dev branch March 11, 2025 16:06
@huxuan huxuan restored the xuan.hu/remove-sync-dev branch March 11, 2025 16:06
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