Skip to content

Commit 1ab4d96

Browse files
committed
Improving tests cleanup
1 parent 5f7da6a commit 1ab4d96

File tree

9 files changed

+40
-392
lines changed

9 files changed

+40
-392
lines changed

awswrangler/pandas.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -916,17 +916,19 @@ def data_to_s3(self,
916916
@staticmethod
917917
def _data_to_s3_dataset_writer(dataframe: pd.DataFrame,
918918
path: str,
919-
partition_cols,
919+
partition_cols: Optional[List[str]],
920920
preserve_index: bool,
921921
compression,
922922
session_primitives: "SessionPrimitives",
923923
file_format: str,
924924
cast_columns=None,
925925
extra_args: Optional[Dict[str, Optional[str]]] = None,
926926
isolated_dataframe: bool = False):
927-
objects_paths = []
927+
objects_paths: List[str] = []
928928
dataframe = Pandas._cast_pandas(dataframe=dataframe, cast_columns=cast_columns)
929-
cast_columns_materialized = {c: t for c, t in cast_columns.items() if c not in partition_cols}
929+
if partition_cols is None:
930+
partition_cols = []
931+
cast_columns_materialized: Dict[str, str] = {c: t for c, t in cast_columns.items() if c not in partition_cols}
930932
if not partition_cols:
931933
object_path = Pandas._data_to_s3_object_writer(dataframe=dataframe,
932934
path=path,
@@ -1001,7 +1003,7 @@ def _data_to_s3_object_writer(dataframe: pd.DataFrame,
10011003
compression: str,
10021004
session_primitives: "SessionPrimitives",
10031005
file_format: str,
1004-
cast_columns: Optional[List[str]] = None,
1006+
cast_columns: Optional[Dict[str, str]] = None,
10051007
extra_args: Optional[Dict[str, Optional[str]]] = None,
10061008
isolated_dataframe=False) -> str:
10071009
fs = get_fs(session_primitives=session_primitives)

demo/getting_started.ipynb

Lines changed: 0 additions & 323 deletions
This file was deleted.

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
numpy~=1.18.1
22
pandas~=0.25.3
33
pyarrow~=0.15.1
4-
botocore~=1.13.47
5-
boto3~=1.10.47
4+
botocore~=1.13.48
5+
boto3~=1.10.48
66
s3fs~=0.4.0
77
tenacity~=6.0.0
88
pg8000~=1.13.2

testing/test_awswrangler/test_athena.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import boto3
77
import pandas as pd
88

9+
import awswrangler as wr
910
from awswrangler import Session, Athena
1011
from awswrangler.exceptions import QueryCancelled, QueryFailed
1112

@@ -34,6 +35,10 @@ def database(cloudformation_outputs):
3435
else:
3536
raise Exception("You must deploy the test infrastructure using Cloudformation!")
3637
yield database
38+
tables = wr.glue.tables(database=database)["Table"].tolist()
39+
for t in tables:
40+
print(f"Dropping: {database}.{t}...")
41+
wr.glue.delete_table_if_exists(database=database, table=t)
3742

3843

3944
@pytest.fixture(scope="module")

testing/test_awswrangler/test_glue.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def database(cloudformation_outputs):
4343
else:
4444
raise Exception("You must deploy the test infrastructure using SAM!")
4545
yield database
46+
tables = wr.glue.tables(database=database)["Table"].tolist()
47+
for t in tables:
48+
print(f"Dropping: {database}.{t}...")
49+
wr.glue.delete_table_if_exists(database=database, table=t)
4650

4751

4852
@pytest.fixture(scope="module")

0 commit comments

Comments
 (0)