Skip to content

Commit

Permalink
verifying close mock
Browse files Browse the repository at this point in the history
  • Loading branch information
riya-17 committed Jun 24, 2023
1 parent 1c9ee2d commit b05aca5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/pbench/test/unit/server/test_datasets_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ def test_not_a_file(self, query_get_as, monkeypatch):
}

def test_dataset_in_given_path(self, query_get_as, monkeypatch):
mock_close = False

class MockBytesIO(io.BytesIO):
def close(self):
nonlocal mock_close
mock_close = True
super().close()

mock_args: Optional[tuple[Path, dict[str, Any]]] = None
Expand Down Expand Up @@ -143,3 +147,4 @@ def mock_send_file(path_or_file, *args, **kwargs):
assert file_content == exp_stream
assert args["as_attachment"] is False
assert args["download_name"] == "f1.json"
assert mock_close

0 comments on commit b05aca5

Please sign in to comment.