-
Notifications
You must be signed in to change notification settings - Fork 145
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
Better double asterisk support #572
Merged
martindurant
merged 5 commits into
fsspec:main
from
john-jam:better-double-asterisk-support
Aug 24, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ceafb1c
fix: update the tests
john-jam b8fb780
feat: add derived tests for copy, get and put
john-jam 41a45ca
fix: run pre commits
john-jam 04ae88b
fix: add missing fixture def
john-jam c4f467b
fix: strip right slash only when maxdepth is passed
john-jam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import fsspec | ||
import pytest | ||
from fsspec.tests.abstract import AbstractFixtures | ||
|
||
from gcsfs.core import GCSFileSystem | ||
from gcsfs.tests.conftest import allfiles | ||
from gcsfs.tests.settings import TEST_BUCKET | ||
|
||
|
||
class GcsfsFixtures(AbstractFixtures): | ||
@pytest.fixture(scope="class") | ||
def fs(self, docker_gcs): | ||
GCSFileSystem.clear_instance_cache() | ||
gcs = fsspec.filesystem("gcs", endpoint_url=docker_gcs) | ||
try: | ||
# ensure we're empty. | ||
try: | ||
gcs.rm(TEST_BUCKET, recursive=True) | ||
except FileNotFoundError: | ||
pass | ||
try: | ||
gcs.mkdir(TEST_BUCKET) | ||
except Exception: | ||
pass | ||
|
||
gcs.pipe({TEST_BUCKET + "/" + k: v for k, v in allfiles.items()}) | ||
gcs.invalidate_cache() | ||
yield gcs | ||
finally: | ||
try: | ||
gcs.rm(gcs.find(TEST_BUCKET)) | ||
gcs.rm(TEST_BUCKET) | ||
except: # noqa: E722 | ||
pass | ||
|
||
@pytest.fixture | ||
def fs_path(self): | ||
return TEST_BUCKET | ||
|
||
@pytest.fixture | ||
def supports_empty_directories(self): | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import fsspec.tests.abstract as abstract | ||
|
||
from gcsfs.tests.derived.gcsfs_fixtures import GcsfsFixtures | ||
|
||
|
||
class TestGcsfsCopy(abstract.AbstractCopyTests, GcsfsFixtures): | ||
pass | ||
|
||
|
||
class TestGcsfsGet(abstract.AbstractGetTests, GcsfsFixtures): | ||
pass | ||
|
||
|
||
class TestGcsfsPut(abstract.AbstractPutTests, GcsfsFixtures): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,7 +274,7 @@ def test_gcs_glob(gcs): | |
fn = TEST_BUCKET + "/nested/file1" | ||
assert fn not in gcs.glob(TEST_BUCKET + "/") | ||
assert fn not in gcs.glob(TEST_BUCKET + "/*") | ||
assert fn in gcs.glob(TEST_BUCKET + "/nested/") | ||
assert fn not in gcs.glob(TEST_BUCKET + "/nested/") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing slashes in globs now returns only the directories. |
||
assert fn in gcs.glob(TEST_BUCKET + "/nested/*") | ||
assert fn in gcs.glob(TEST_BUCKET + "/nested/file*") | ||
assert fn in gcs.glob(TEST_BUCKET + "/*/*") | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The depth is wrong when there is a trailing slash in the source path. We could also strip it at the very beginning of the
_find
method (the tests also works).