Skip to content

Commit

Permalink
addin prints
Browse files Browse the repository at this point in the history
  • Loading branch information
ilongin committed Oct 9, 2024
1 parent 981d92e commit a20e5df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def tests(session: nox.Session) -> None:
session.install(".[tests]")
session.run(
"pytest",
"tests/func/test_listing.py",
"-k test_listing_generator",
"-vvv",
"--capture=sys",
"--cov",
Expand Down
4 changes: 4 additions & 0 deletions src/datachain/lib/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def list_func() -> Iterator[File]:
config = client_config or {}
client = Client.get_client(uri, cache, **config) # type: ignore[arg-type]
_, path = Client.parse_url(uri)
print(
f"Inside list bucket, uri is {uri} client name is {client.name}",
f" path is {path}",
)
for entries in iter_over_async(client.scandir(path.rstrip("/")), get_loop()):
yield from entries

Expand Down
3 changes: 2 additions & 1 deletion tests/func/test_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def test_listing_generator(cloud_test_catalog, cloud_type):
catalog = ctc.catalog

uri = f"{ctc.src_uri}/cats"
print(f"src uri is {ctc.src_uri}")

dc = DataChain.from_records(DataChain.DEFAULT_FILE_RECORD).gen(
file=list_bucket(uri, catalog.cache, client_config=catalog.client_config)
Expand All @@ -20,7 +21,7 @@ def test_listing_generator(cloud_test_catalog, cloud_type):
files = sorted(dc.collect("file"), key=lambda f: f.path)

for cat_file, cat_entry in zip(files, entries):
assert cat_file.source == cloud_test_catalog.src_uri
assert cat_file.source == ctc.src_uri
assert cat_file.path == cat_entry.path
assert cat_file.size == cat_entry.size
assert cat_file.is_latest == cat_entry.is_latest
Expand Down

0 comments on commit a20e5df

Please sign in to comment.