|
19 | 19 |
|
20 | 20 | import pytest
|
21 | 21 |
|
| 22 | +from ..helpers import make_connection |
| 23 | +from .helpers import _make_client |
| 24 | +from .helpers import _make_job_resource |
22 | 25 |
|
23 | 26 | try:
|
24 | 27 | from google.cloud import bigquery_storage
|
25 | 28 | import google.cloud.bigquery_storage_v1.reader
|
26 | 29 | import google.cloud.bigquery_storage_v1.services.big_query_read.client
|
27 |
| -except (ImportError, AttributeError): # pragma: NO COVER |
| 30 | +except (ImportError, AttributeError): |
28 | 31 | bigquery_storage = None
|
29 | 32 |
|
30 |
| -try: |
31 |
| - import pandas |
32 |
| -except (ImportError, AttributeError): # pragma: NO COVER |
33 |
| - pandas = None |
34 | 33 | try:
|
35 | 34 | import shapely
|
36 |
| -except (ImportError, AttributeError): # pragma: NO COVER |
| 35 | +except (ImportError, AttributeError): |
37 | 36 | shapely = None
|
38 | 37 | try:
|
39 | 38 | import geopandas
|
40 |
| -except (ImportError, AttributeError): # pragma: NO COVER |
| 39 | +except (ImportError, AttributeError): |
41 | 40 | geopandas = None
|
42 | 41 | try:
|
43 | 42 | import tqdm
|
44 |
| -except (ImportError, AttributeError): # pragma: NO COVER |
| 43 | +except (ImportError, AttributeError): |
45 | 44 | tqdm = None
|
46 | 45 |
|
47 |
| -try: |
48 |
| - import importlib.metadata as metadata |
49 |
| -except ImportError: |
50 |
| - import importlib_metadata as metadata |
51 |
| - |
52 |
| -from ..helpers import make_connection |
53 |
| -from .helpers import _make_client |
54 |
| -from .helpers import _make_job_resource |
55 |
| - |
56 |
| -if pandas is not None: |
57 |
| - PANDAS_INSTALLED_VERSION = metadata.version("pandas") |
58 |
| -else: |
59 |
| - PANDAS_INSTALLED_VERSION = "0.0.0" |
60 |
| - |
61 |
| -pandas = pytest.importorskip("pandas") |
62 |
| - |
63 | 46 | try:
|
64 | 47 | import pyarrow
|
65 | 48 | import pyarrow.types
|
66 |
| -except ImportError: # pragma: NO COVER |
| 49 | +except ImportError: |
67 | 50 | pyarrow = None
|
68 | 51 |
|
| 52 | +pandas = pytest.importorskip("pandas") |
| 53 | + |
69 | 54 |
|
70 | 55 | @pytest.fixture
|
71 | 56 | def table_read_options_kwarg():
|
@@ -660,7 +645,10 @@ def test_to_dataframe_bqstorage_no_pyarrow_compression():
|
660 | 645 | )
|
661 | 646 |
|
662 | 647 |
|
663 |
| -@pytest.mark.skipif(PANDAS_INSTALLED_VERSION[0:2] not in ["0.", "1."], reason="") |
| 648 | +@pytest.mark.skipif( |
| 649 | + pandas.__version__.startswith("2."), |
| 650 | + reason="pandas 2.0 changes some default dtypes and we haven't update the test to account for those", |
| 651 | +) |
664 | 652 | @pytest.mark.skipif(pyarrow is None, reason="Requires `pyarrow`")
|
665 | 653 | def test_to_dataframe_column_dtypes():
|
666 | 654 | from google.cloud.bigquery.job import QueryJob as target_class
|
|
0 commit comments