Skip to content

Commit

Permalink
Merge pull request #12 from Othoz/fixing-parameter-url
Browse files Browse the repository at this point in the history
Releasing 0.4.2
  • Loading branch information
birnbaum authored Jul 31, 2019
2 parents c2ef261 + 93f30ae commit ecef345
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Possible types of changes are:
Unreleased
----------

0.4.2 - 30.08.2019
------------------

Fixed
'''''
- Fixed a bug where the url parameter ``strict`` was not considered by GCSFS, e.g. in ``open_fs("gs://bucket_name?strict=False")``


0.4.1 - 18.12.2018
------------------

Expand Down
7 changes: 6 additions & 1 deletion fs_gcsfs/opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ def open_fs(self, fs_url, parse_result, writeable, create, cwd): # pylint: disa
if not bucket_name:
raise OpenerError("invalid bucket name in '{}'".format(fs_url))

return GCSFS(bucket_name, root_path=root_path, create=create)
if parse_result.params.get("strict") == "False":
strict = False
else:
strict = True

return GCSFS(bucket_name, root_path=root_path, create=create, strict=strict)
13 changes: 13 additions & 0 deletions fs_gcsfs/tests/test_gcsfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import uuid

import pytest
from fs import open_fs
from fs.errors import IllegalBackReference, CreateFailed
from fs.test import FSTestCases
from google.cloud.storage import Client
Expand Down Expand Up @@ -161,3 +162,15 @@ def test_instantiation_fails_if_no_access_to_bucket():
def test_instantiation_with_create_false_fails_for_non_existing_root_path():
with pytest.raises(CreateFailed):
GCSFS(bucket_name=TEST_BUCKET, root_path=str(uuid.uuid4()), create=False)


@pytest.mark.parametrize("query_param, strict", [
("", True),
("nonExisting=True", True),
("strict=True", True),
("strict=False", False)
])
def test_open_fs_url_strict_parameter_works(query_param, strict):
fs = open_fs("gs://{}?{}".format(TEST_BUCKET, query_param))
assert fs.strict == strict

0 comments on commit ecef345

Please sign in to comment.