Skip to content

Commit

Permalink
Check for return value on dataset delete
Browse files Browse the repository at this point in the history
  • Loading branch information
BenGalewsky committed Nov 25, 2024
1 parent c4c8562 commit 1df9c49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion servicex/servicex_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async def get_dataset(self, dataset_id=None) -> CachedDataset:
dataset = CachedDataset(**result)
return dataset

async def delete_dataset(self, dataset_id=None):
async def delete_dataset(self, dataset_id=None) -> bool:
headers = await self._get_authorization()
path_template = '/servicex/datasets/{dataset_id}'
url = self.url + path_template.format(dataset_id=dataset_id)
Expand All @@ -189,6 +189,8 @@ async def delete_dataset(self, dataset_id=None):
elif r.status != 200:
msg = await _extract_message(r)
raise RuntimeError(f"Failed to delete dataset {dataset_id} - {msg}")
result = await r.json()
return result['stale']

async def submit_transform(self, transform_request: TransformRequest) -> str:
headers = await self._get_authorization()
Expand Down
3 changes: 2 additions & 1 deletion tests/test_servicex_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,12 @@ async def test_delete_dataset(delete, servicex):
}
delete.return_value.__aenter__.return_value.status = 200

await servicex.delete_dataset(123)
r = await servicex.delete_dataset(123)
delete.assert_called_with(
url='https://servicex.org/servicex/datasets/123',
headers={}
)
assert r


@pytest.mark.asyncio
Expand Down

0 comments on commit 1df9c49

Please sign in to comment.