Skip to content

Commit

Permalink
REF/TST: mixed use of mock/monkeypatch (pandas-dev#24557)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins authored and Pingviinituutti committed Feb 28, 2019
1 parent 09e6321 commit af51d2c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pandas/tests/io/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
from pandas import DataFrame, compat
import pandas.util.testing as tm

try:
from unittest import mock
except ImportError:
mock = pytest.importorskip("mock")


api_exceptions = pytest.importorskip("google.api_core.exceptions")
bigquery = pytest.importorskip("google.cloud.bigquery")
service_account = pytest.importorskip("google.oauth2.service_account")
Expand Down Expand Up @@ -104,8 +98,10 @@ def make_mixed_dataframe_v2(test_size):
def test_read_gbq_without_dialect_warns_future_change(monkeypatch):
# Default dialect is changing to standard SQL. See:
# https://github.com/pydata/pandas-gbq/issues/195
mock_read_gbq = mock.Mock()
mock_read_gbq.return_value = DataFrame([[1.0]])

def mock_read_gbq(*args, **kwargs):
return DataFrame([[1.0]])

monkeypatch.setattr(pandas_gbq, 'read_gbq', mock_read_gbq)
with tm.assert_produces_warning(FutureWarning):
pd.read_gbq("SELECT 1")
Expand Down

0 comments on commit af51d2c

Please sign in to comment.