Skip to content

Commit

Permalink
Add tests using the fastparquet engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
tswast committed Mar 22, 2019
1 parent 18729f6 commit 4bca63f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions bigquery/docs/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
import pytest
import six

try:
import fastparquet
except (ImportError, AttributeError):
fastparquet = None
try:
import pandas
except (ImportError, AttributeError):
Expand Down Expand Up @@ -3108,8 +3112,15 @@ def test_list_rows_as_dataframe(client):


@pytest.mark.skipif(pandas is None, reason="Requires `pandas`")
@pytest.mark.skipif(pyarrow is None, reason="Requires `pyarrow`")
def test_load_table_from_dataframe(client, to_delete):
@pytest.mark.parametrize("parquet_engine", ["pyarrow", "fastparquet"])
def test_load_table_from_dataframe(client, to_delete, parquet_engine):
if parquet_engine == "pyarrow" and pyarrow is None:
pytest.skip("Requires `pyarrow`")
if parquet_engine == "fastparquet" and fastparquet is None:
pytest.skip("Requires `fastparquet`")

pandas.set_option("io.parquet.engine", parquet_engine)

dataset_id = "load_table_from_dataframe_{}".format(_millis())
dataset = bigquery.Dataset(client.dataset(dataset_id))
client.create_dataset(dataset)
Expand Down
2 changes: 1 addition & 1 deletion bigquery/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def snippets(session):
session.install('-e', local_dep)
session.install('-e', os.path.join('..', 'storage'))
session.install('-e', os.path.join('..', 'test_utils'))
session.install('-e', '.[pandas, pyarrow]')
session.install('-e', '.[pandas, pyarrow, fastparquet]')

# Run py.test against the snippets tests.
session.run(
Expand Down

0 comments on commit 4bca63f

Please sign in to comment.