Skip to content

Commit af51d2c

Browse files
simonjayhawkinsPingviinituutti
authored andcommitted
REF/TST: mixed use of mock/monkeypatch (pandas-dev#24557)
1 parent 09e6321 commit af51d2c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

pandas/tests/io/test_gbq.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
from pandas import DataFrame, compat
1313
import pandas.util.testing as tm
1414

15-
try:
16-
from unittest import mock
17-
except ImportError:
18-
mock = pytest.importorskip("mock")
19-
20-
2115
api_exceptions = pytest.importorskip("google.api_core.exceptions")
2216
bigquery = pytest.importorskip("google.cloud.bigquery")
2317
service_account = pytest.importorskip("google.oauth2.service_account")
@@ -104,8 +98,10 @@ def make_mixed_dataframe_v2(test_size):
10498
def test_read_gbq_without_dialect_warns_future_change(monkeypatch):
10599
# Default dialect is changing to standard SQL. See:
106100
# https://github.com/pydata/pandas-gbq/issues/195
107-
mock_read_gbq = mock.Mock()
108-
mock_read_gbq.return_value = DataFrame([[1.0]])
101+
102+
def mock_read_gbq(*args, **kwargs):
103+
return DataFrame([[1.0]])
104+
109105
monkeypatch.setattr(pandas_gbq, 'read_gbq', mock_read_gbq)
110106
with tm.assert_produces_warning(FutureWarning):
111107
pd.read_gbq("SELECT 1")

0 commit comments

Comments
 (0)