Skip to content

Commit 2622cb3

Browse files
committed
BUG: Use StrictVersion instead of LooseVersion when testing for minimum google api client version #10652
1 parent 2dbd38e commit 2622cb3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

doc/source/whatsnew/v0.17.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1146,3 +1146,4 @@ Bug Fixes
11461146
- Bug in ``DatetimeIndex`` cannot infer negative freq (:issue:`11018`)
11471147
- Remove use of some deprecated numpy comparison operations, mainly in tests. (:issue:`10569`)
11481148
- Bug in ``Index`` dtype may not applied properly (:issue:`11017`)
1149+
- Bug in ``io.gbq`` when testing for minimum google api client version (:issue:`10652`)

pandas/io/gbq.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import numpy as np
99

10-
from distutils.version import LooseVersion
10+
from distutils.version import StrictVersion
1111
from pandas import compat
1212
from pandas.core.api import DataFrame
1313
from pandas.tools.merge import concat
@@ -26,7 +26,7 @@ def _check_google_client_version():
2626

2727
_GOOGLE_API_CLIENT_VERSION = pkg_resources.get_distribution('google-api-python-client').version
2828

29-
if LooseVersion(_GOOGLE_API_CLIENT_VERSION) < '1.2.0':
29+
if StrictVersion(_GOOGLE_API_CLIENT_VERSION) < StrictVersion('1.2.0'):
3030
raise ImportError("pandas requires google-api-python-client >= 1.2.0 for Google "
3131
"BigQuery support, current version " + _GOOGLE_API_CLIENT_VERSION)
3232

pandas/io/tests/test_gbq.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import numpy as np
1414

15-
from distutils.version import LooseVersion
15+
from distutils.version import StrictVersion
1616
from pandas import compat
1717

1818
from pandas import NaT
@@ -65,7 +65,7 @@ def _test_imports():
6565
_GOOGLE_API_CLIENT_INSTALLED=True
6666
_GOOGLE_API_CLIENT_VERSION = pkg_resources.get_distribution('google-api-python-client').version
6767

68-
if LooseVersion(_GOOGLE_API_CLIENT_VERSION) >= '1.2.0':
68+
if StrictVersion(_GOOGLE_API_CLIENT_VERSION) >= StrictVersion('1.2.0'):
6969
_GOOGLE_API_CLIENT_VALID_VERSION = True
7070

7171
except ImportError:

0 commit comments

Comments
 (0)