Skip to content

Delegate DirFileSystem delete and write_text#2022

Merged
martindurant merged 2 commits intofsspec:masterfrom
ShipItAndPray:fix-1997-dirfs-delegates-write-text-delete
Apr 29, 2026
Merged

Delegate DirFileSystem delete and write_text#2022
martindurant merged 2 commits intofsspec:masterfrom
ShipItAndPray:fix-1997-dirfs-delegates-write-text-delete

Conversation

@ShipItAndPray
Copy link
Copy Markdown
Contributor

Summary

  • delegate DirFileSystem.delete() to the wrapped filesystem instead of inheriting the base alias path
  • delegate DirFileSystem.write_text() so wrapper filesystems can enforce their own write behavior
  • add focused regression tests for both methods

Closes #1997.

Validation

  • E1 baseline repro exists: yes
    • The issue's reproduction on baseline allowed both fs.write_text('bar', 'lorem ipsum') and fs.delete('bar') to succeed instead of raising from the wrapped filesystem.
  • E2 new regression tests fail on baseline: yes
    • In a temporary HEAD worktree with only the new tests applied:
    • .venv/bin/python -m pytest fsspec/implementations/tests/test_dirfs.py -k 'delete or write_text' -q
    • Result: 4 failed, 134 deselected
  • E3 regression tests pass after fix: yes
    • .venv/bin/python -m pytest fsspec/implementations/tests/test_dirfs.py -q
    • Result: 138 passed
  • E4 direct issue repro matches expected behavior after fix: yes
    • The issue script now raises NotImplementedError for both write_text and delete, proving delegation reaches the wrapped filesystem.
  • E5 diff stays localized: yes
    • Changes are limited to fsspec/implementations/dirfs.py and fsspec/implementations/tests/test_dirfs.py.

@martindurant martindurant merged commit e9e7a5b into fsspec:master Apr 29, 2026
10 of 11 checks passed
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.

DirFileSystem does not delegate write_text and delete

3 participants