Skip to content

Commit da81e2b

Browse files
committed
tests: more debugging and properly fetch groups
1 parent d297bb9 commit da81e2b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

ckanext/dcor_schemas/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def dcor_purge_unused_collections_and_circles(
251251
dry_run: bool = False):
252252
"""Purge old collections and circles that don't contain any datasets"""
253253
# Iterate over all collections
254-
for group in model.Group.iterall():
254+
for (group,) in model.Session.query(model.Group.id).all():
255255
# Check group children
256256
if group.get_children_groups():
257257
print(f"Ignoring group '{group.id}' with children")

ckanext/dcor_schemas/tests/test_cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def test_dcor_prune_draft_datasets(cli):
257257
res = cli.invoke(ckan_cli,
258258
["dcor-prune-draft-datasets",
259259
"--older-than-days", "1"])
260+
print(res.output_bytes)
260261
assert res.exit_code == 0
261262
assert helpers.call_action("package_show", id=ds_dict["id"])
262263

@@ -397,6 +398,7 @@ def test_dcor_purge_unused_collections_and_circles(cli):
397398
# since they were just created.
398399
res = cli.invoke(ckan_cli,
399400
["dcor-purge-unused-collections-and-circles"])
401+
print(res.output_bytes)
400402
assert res.exit_code == 0
401403
assert helpers.call_action("group_show",
402404
context,

0 commit comments

Comments
 (0)