Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ac10e76
feat: add bigquery job id to tqdm progress bar description
aribray Sep 15, 2022
9db15fc
write to sys.stdout instead of sys.stderr
aribray Sep 20, 2022
6ed2f03
Merge remote-tracking branch 'upstream/main' into aribray--tqdm
aribray Sep 23, 2022
c3ec846
configure progress bar
aribray Sep 23, 2022
f50bf8b
tqdm.notebook
aribray Sep 23, 2022
0c41c9e
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Sep 23, 2022
d679134
reinclude ipywidgets
aribray Sep 23, 2022
87212a5
Merge branch 'aribray--tqdm' of github.com:aribray/python-bigquery in…
aribray Sep 23, 2022
be991b7
reinclude ipywidgets
aribray Sep 23, 2022
c6317a4
change test assertions to tqdm_notebook
aribray Sep 23, 2022
13331b9
change test assertions in test_magics
aribray Sep 23, 2022
d86ae58
remove ipywidgets
aribray Sep 23, 2022
a6c3e88
update assertions in test
aribray Sep 23, 2022
adcef3b
update method args in query.py and table.py
aribray Sep 26, 2022
f50600e
string formatting
aribray Sep 26, 2022
7162f0e
fix typo
aribray Sep 27, 2022
cef0491
fix incorrect import structure for tqdm notebook
aribray Sep 28, 2022
46c3d95
change default decorator back to tqdm
aribray Sep 28, 2022
11966b8
Merge branch 'main' of github.com:aribray/python-bigquery into aribra…
aribray Oct 4, 2022
dfd965f
modify system test
aribray Oct 4, 2022
e785c84
add ipywidgets package for tqdm.notebook feature, set tqdm.notebook a…
aribray Oct 4, 2022
2932a52
change test assertion in test_query_pandas
aribray Oct 5, 2022
54b90e7
revert test changes
aribray Oct 5, 2022
3ea255f
Merge branch 'main' of github.com:aribray/python-bigquery into aribra…
aribray Oct 5, 2022
b94c863
reformat import statement
aribray Oct 6, 2022
4114221
reformat import statement
aribray Oct 6, 2022
09a6608
remove timeouterror side effect
aribray Oct 6, 2022
ef809a0
add tqdm mock patch
aribray Oct 6, 2022
9f174bb
Revert "reformat import statement"
aribray Oct 6, 2022
eabc228
Revert "add tqdm mock patch"
aribray Oct 6, 2022
de9ee35
add timeout side effect
aribray Oct 7, 2022
bd35f96
fix assertion
aribray Oct 7, 2022
f471b8c
fix import
aribray Oct 7, 2022
99e108b
change mock patch to tqdm
aribray Oct 7, 2022
3f53ad5
move assertion
aribray Oct 7, 2022
4e901d4
move assertions
aribray Oct 7, 2022
30a3688
add timeout side effect
aribray Oct 7, 2022
122c5a5
adjust import statement, mock.patch tqdm
aribray Oct 7, 2022
bf4b1c2
create fixture
aribray Oct 7, 2022
84a5073
revert import change
aribray Oct 7, 2022
fd6b101
add import from helper
aribray Oct 7, 2022
9bedca6
fix linting
aribray Oct 7, 2022
a7e361c
Merge branch 'main' of github.com:aribray/python-bigquery into aribra…
aribray Oct 7, 2022
0dfc48d
remove unused imort
aribray Oct 7, 2022
ef3fc98
set ipywidgets version to 7.7.1
aribray Oct 10, 2022
846e66a
Merge branch 'main' of github.com:aribray/python-bigquery into aribra…
aribray Oct 10, 2022
05423ff
set ipywidgets version to 7.7.1
aribray Oct 10, 2022
f06e44d
set ipywidgets version to 7.7.1
aribray Oct 10, 2022
beb9675
Merge branch 'main' of github.com:aribray/python-bigquery into aribra…
aribray Oct 10, 2022
f84f75c
bump sphinx version
aribray Oct 10, 2022
b0c40c5
bump sphinx version
aribray Oct 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
create fixture
  • Loading branch information
aribray committed Oct 7, 2022
commit bf4b1c2299220c4f70451b3d86d04e835ea9fd60
29 changes: 11 additions & 18 deletions tests/unit/job/test_query_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def table_read_options_kwarg():
)
return {"read_options": read_options}

@pytest.fixture
def tqdm_mock():
with mock.patch("tqdm.tqdm") as tqdm_mock:
yield tqdm_mock

@pytest.mark.parametrize(
"query,expected",
Expand Down Expand Up @@ -301,7 +305,7 @@ def test_to_arrow_max_results_no_progress_bar():


@pytest.mark.skipif(tqdm is None, reason="Requires `tqdm`")
def test_to_arrow_w_tqdm_w_query_plan():
def test_to_arrow_w_tqdm_w_query_plan(tqdm_mock):
from google.cloud.bigquery import table
from google.cloud.bigquery.job import QueryJob as target_class
from google.cloud.bigquery.schema import SchemaField
Expand Down Expand Up @@ -344,7 +348,6 @@ def test_to_arrow_w_tqdm_w_query_plan():
row_iterator,
],
)
tqdm_mock = mock.patch("tqdm.tqdm")
with result_patch as tqdm_mock, reload_patch:
tbl = job.to_arrow(progress_bar_type="tqdm", create_bqstorage_client=False)

Expand All @@ -357,7 +360,7 @@ def test_to_arrow_w_tqdm_w_query_plan():


@pytest.mark.skipif(tqdm is None, reason="Requires `tqdm`")
def test_to_arrow_w_tqdm_w_pending_status():
def test_to_arrow_w_tqdm_w_pending_status(tqdm_mock):
from google.cloud.bigquery import table
from google.cloud.bigquery.job import QueryJob as target_class
from google.cloud.bigquery.schema import SchemaField
Expand Down Expand Up @@ -396,7 +399,6 @@ def test_to_arrow_w_tqdm_w_pending_status():
"google.cloud.bigquery.job.QueryJob.result",
side_effect=[concurrent.futures.TimeoutError, row_iterator],
)
tqdm_mock = mock.patch("tqdm.tqdm")
with result_patch as tqdm_mock, reload_patch:
tbl = job.to_arrow(progress_bar_type="tqdm", create_bqstorage_client=False)

Expand All @@ -409,7 +411,7 @@ def test_to_arrow_w_tqdm_w_pending_status():


@pytest.mark.skipif(tqdm is None, reason="Requires `tqdm`")
def test_to_arrow_w_tqdm_wo_query_plan():
def test_to_arrow_w_tqdm_wo_query_plan(tqdm_mock):
from google.cloud.bigquery import table
from google.cloud.bigquery.job import QueryJob as target_class
from google.cloud.bigquery.schema import SchemaField
Expand Down Expand Up @@ -439,7 +441,6 @@ def test_to_arrow_w_tqdm_wo_query_plan():
"google.cloud.bigquery.job.QueryJob.result",
side_effect=[concurrent.futures.TimeoutError, row_iterator],
)
tqdm_mock = mock.patch("tqdm.tqdm")
with result_patch as tqdm_mock, reload_patch:
tbl = job.to_arrow(progress_bar_type="tqdm", create_bqstorage_client=False)

Expand Down Expand Up @@ -720,7 +721,7 @@ def test_to_dataframe_column_date_dtypes():


@pytest.mark.skipif(tqdm is None, reason="Requires `tqdm`")
def test_to_dataframe_with_progress_bar():
def test_to_dataframe_with_progress_bar(tqdm_mock):
from google.cloud.bigquery.job import QueryJob as target_class

begun_resource = _make_job_resource(job_type="query")
Expand All @@ -741,7 +742,6 @@ def test_to_dataframe_with_progress_bar():
)
client = _make_client(connection=connection)
job = target_class.from_api_repr(begun_resource, client)
tqdm_mock = mock.patch("tqdm.tqdm")

job.to_dataframe(progress_bar_type=None, create_bqstorage_client=False)
tqdm_mock.assert_not_called()
Expand All @@ -751,12 +751,11 @@ def test_to_dataframe_with_progress_bar():


@pytest.mark.skipif(tqdm is None, reason="Requires `tqdm`")
def test_to_dataframe_w_tqdm_pending():
def test_to_dataframe_w_tqdm_pending(tqdm_mock):
from google.cloud.bigquery import table
from google.cloud.bigquery.job import QueryJob as target_class
from google.cloud.bigquery.schema import SchemaField
from google.cloud.bigquery._tqdm_helpers import _PROGRESS_BAR_UPDATE_INTERVAL
from google.cloud.bigquery._tqdm_helpers import get_progress_bar

begun_resource = _make_job_resource(job_type="query")
schema = [
Expand Down Expand Up @@ -793,9 +792,6 @@ def test_to_dataframe_w_tqdm_pending():
"google.cloud.bigquery.job.QueryJob.result",
side_effect=[concurrent.futures.TimeoutError, row_iterator],
)

tqdm_mock = mock.patch("tqdm.tqdm")

with result_patch as tqdm_mock, reload_patch:
df = job.to_dataframe(progress_bar_type="tqdm", create_bqstorage_client=False)

Expand All @@ -809,7 +805,7 @@ def test_to_dataframe_w_tqdm_pending():


@pytest.mark.skipif(tqdm is None, reason="Requires `tqdm`")
def test_to_dataframe_w_tqdm():
def test_to_dataframe_w_tqdm(tqdm_mock):
from google.cloud.bigquery import table
from google.cloud.bigquery.job import QueryJob as target_class
from google.cloud.bigquery.schema import SchemaField
Expand Down Expand Up @@ -855,8 +851,6 @@ def test_to_dataframe_w_tqdm():
],
)

tqdm_mock = mock.patch("tqdm.tqdm")

with result_patch as tqdm_mock, reload_patch:
df = job.to_dataframe(progress_bar_type="tqdm", create_bqstorage_client=False)

Expand All @@ -870,7 +864,7 @@ def test_to_dataframe_w_tqdm():


@pytest.mark.skipif(tqdm is None, reason="Requires `tqdm`")
def test_to_dataframe_w_tqdm_max_results():
def test_to_dataframe_w_tqdm_max_results(tqdm_mock):
from google.cloud.bigquery import table
from google.cloud.bigquery.job import QueryJob as target_class
from google.cloud.bigquery.schema import SchemaField
Expand Down Expand Up @@ -906,7 +900,6 @@ def test_to_dataframe_w_tqdm_max_results():
"google.cloud.bigquery.job.QueryJob.result",
side_effect=[concurrent.futures.TimeoutError, row_iterator],
)
tqdm_mock = mock.patch("tqdm.tqdm")
with result_patch as tqdm_mock, reload_patch:
job.to_dataframe(
progress_bar_type="tqdm", create_bqstorage_client=False, max_results=3
Expand Down