Skip to content

Commit 0f16f57

Browse files
committed
fs texture returns uri instead of each {filesystem}_fs
1 parent 17fc1bf commit 0f16f57

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

tests/test_filesystem.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
ROOT_PREFIX = f"tf-io-root-{int(time.time())}/"
3030

3131
# This is the number of attributes each filesystem should return in `*_fs`.
32-
NUM_ATR_FS = 7
32+
NUM_ATR_FS = 6
3333

3434
S3_URI = "s3"
3535
AZ_URI = "az"
@@ -127,7 +127,7 @@ def mkdirs(path):
127127
path += "/"
128128
write(path, b"")
129129

130-
yield S3_URI, path_to, read, write, mkdirs, posixpath.join, (client, bucket_name)
130+
yield path_to, read, write, mkdirs, posixpath.join, (client, bucket_name)
131131
monkeypatch.undo()
132132

133133

@@ -182,7 +182,7 @@ def mkdirs(path):
182182
if path[-1] == "/":
183183
write(path, b"")
184184

185-
yield AZ_URI, path_to, read, write, mkdirs, posixpath.join, (
185+
yield path_to, read, write, mkdirs, posixpath.join, (
186186
client,
187187
container_name,
188188
account,
@@ -196,13 +196,13 @@ def az_dsn_fs(az_fs):
196196
yield [None] * NUM_ATR_FS
197197
return
198198

199-
uri, _, read, write, mkdirs, join, fs_internal = az_fs
199+
_, read, write, mkdirs, join, fs_internal = az_fs
200200
_, container_name, account = fs_internal
201201

202202
def path_to_dsn(*args):
203203
return f"{AZ_URI}://{account}.blob.core.windows.net/{container_name}/{posixpath.join(ROOT_PREFIX, *args)}"
204204

205-
yield uri, path_to_dsn, read, write, mkdirs, join, fs_internal
205+
yield path_to_dsn, read, write, mkdirs, join, fs_internal
206206

207207

208208
@pytest.fixture(scope="module")
@@ -223,7 +223,7 @@ def write(*_):
223223
def mkdirs(_):
224224
pass
225225

226-
yield HTTPS_URI, path_to, read, write, mkdirs, posixpath.join, None
226+
yield path_to, read, write, mkdirs, posixpath.join, None
227227

228228

229229
# TODO(vnvo2409): some tests with `gcs` are falling.
@@ -275,26 +275,28 @@ def mkdirs(path):
275275
path += "/"
276276
write(path, b"")
277277

278-
yield GCS_URI, path_to, read, write, mkdirs, posixpath.join, None
278+
yield path_to, read, write, mkdirs, posixpath.join, None
279279
monkeypatch.undo()
280280

281281

282282
@pytest.fixture
283283
def fs(request, s3_fs, az_fs, az_dsn_fs, https_fs, gcs_fs):
284-
uri, path_to, read, write, mkdirs, join, internal = [None] * NUM_ATR_FS
284+
path_to, read, write, mkdirs, join, internal = [None] * NUM_ATR_FS
285285
test_fs_uri = request.param
286+
real_uri = test_fs_uri
286287
should_skip(test_fs_uri, check_only=False)
287288

288289
if test_fs_uri == S3_URI:
289-
uri, path_to, read, write, mkdirs, join, internal = s3_fs
290+
path_to, read, write, mkdirs, join, internal = s3_fs
290291
elif test_fs_uri == AZ_URI:
291-
uri, path_to, read, write, mkdirs, join, internal = az_fs
292+
path_to, read, write, mkdirs, join, internal = az_fs
292293
elif test_fs_uri == AZ_DSN_URI:
293-
uri, path_to, read, write, mkdirs, join, internal = az_dsn_fs
294+
real_uri = AZ_URI
295+
path_to, read, write, mkdirs, join, internal = az_dsn_fs
294296
elif test_fs_uri == HTTPS_URI:
295-
uri, path_to, read, write, mkdirs, join, internal = https_fs
297+
path_to, read, write, mkdirs, join, internal = https_fs
296298
elif test_fs_uri == GCS_URI:
297-
uri, path_to, read, write, mkdirs, join, internal = gcs_fs
299+
path_to, read, write, mkdirs, join, internal = gcs_fs
298300

299301
path_to_rand = None
300302
test_patchs = request.getfixturevalue("patchs")
@@ -304,7 +306,7 @@ def fs(request, s3_fs, az_fs, az_dsn_fs, https_fs, gcs_fs):
304306
path_to_rand = functools.partial(path_to, str(random.getrandbits(32)))
305307
mkdirs(path_to_rand(""))
306308
fs.path_to_rand_cache[(test_fs_uri, test_patchs)] = path_to_rand
307-
yield uri, path_to_rand, read, write, mkdirs, join, internal
309+
yield real_uri, path_to_rand, read, write, mkdirs, join, internal
308310

309311

310312
fs.path_to_rand_cache = {}

0 commit comments

Comments
 (0)