Skip to content

Commit

Permalink
Close the to_dataframe progress bar when finished. (#7757)
Browse files Browse the repository at this point in the history
  • Loading branch information
tswast authored Apr 22, 2019
1 parent ee804a1 commit 3e06961
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bigquery/google/cloud/bigquery/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,10 @@ def _to_dataframe_tabledata_list(self, dtypes, progress_bar=None):
progress_bar.total = progress_bar.total or self.total_rows
progress_bar.update(len(current_frame))

if progress_bar is not None:
# Indicate that the download has finished.
progress_bar.close()

return pandas.concat(frames)

def _to_dataframe_bqstorage_stream(
Expand Down
1 change: 1 addition & 0 deletions bigquery/tests/unit/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,7 @@ def test_to_dataframe_progress_bar(

progress_bar_mock.assert_called()
progress_bar_mock().update.assert_called()
progress_bar_mock().close.assert_called_once()
self.assertEqual(len(df), 4)

@unittest.skipIf(pandas is None, "Requires `pandas`")
Expand Down

0 comments on commit 3e06961

Please sign in to comment.