Skip to content

test: add regression test for --pull path nesting bug (#11005)#11025

Open
hiba-q wants to merge 1 commit intotreeverse:mainfrom
hiba-q:test-pull-path-nesting
Open

test: add regression test for --pull path nesting bug (#11005)#11025
hiba-q wants to merge 1 commit intotreeverse:mainfrom
hiba-q:test-pull-path-nesting

Conversation

@hiba-q
Copy link
Copy Markdown

@hiba-q hiba-q commented Apr 14, 2026

What changed and why?

This PR adds a failing regression test to tests/func/test_import.py to capture a path-resolution bug reported in Issue #11005.

Currently, running dvc exp run --pull on a repository where data was imported using dvc import --no-download behaves correctly the first time. However, if the local target directory is deleted, a subsequent --pull command improperly nests the source directory inside the target (creating target/source/... instead of target/...). This changes the directory structure and MD5 hash, breaking reproducibility.

How it was implemented:

I added a test using pytest and DVC's erepo_dir fixture that programmatically reproduces the exact workflow:

  1. Initializes a repo and runs dvc import --no-download.
  2. Runs dvc exp run --pull.
  3. Deletes the target directory.
  4. Runs dvc exp run --pull again.
  5. Asserts that the improperly nested data/ directory does not exist.

Note: I am submitting this failing test first to provide a reproducible baseline while I continue investigating the ImportStage path mapping logic for a full fix.

References #11005

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

@github-project-automation github-project-automation bot moved this to Backlog in DVC Apr 14, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 5.88235% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.58%. Comparing base (2431ec6) to head (24c3ea2).
⚠️ Report is 201 commits behind head on main.

Files with missing lines Patch % Lines
tests/func/test_import.py 5.88% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11025      +/-   ##
==========================================
- Coverage   90.68%   88.58%   -2.11%     
==========================================
  Files         504      503       -1     
  Lines       39795    41014    +1219     
  Branches     3141     3243     +102     
==========================================
+ Hits        36087    36331     +244     
- Misses       3042     3999     +957     
- Partials      666      684      +18     

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

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