Skip to content

Commit

Permalink
Test for warnings on lack of read/to keys
Browse files Browse the repository at this point in the history
  • Loading branch information
kinghuang committed Aug 28, 2020
1 parent bd848cf commit 16c22fc
Showing 1 changed file with 31 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,19 @@ def test_dataframe_inputs(file_type):
def return_df(_, input_df):
return input_df

file_name = file_relative_path(__file__, f"num.{file_type}")
result = execute_solid(
return_df,
run_config={
"solids": {"return_df": {"inputs": {"input_df": {file_type: {"path": file_name}}}}}
},
)
assert result.success
assert assert_eq(result.output_value(), create_dask_df())
with pytest.warns(
"Specifying {key}: is deprecated. Use read:{key}: instead.".format(key=file_type)
UserWarning,
):
file_name = file_relative_path(__file__, f"num.{file_type}")
result = execute_solid(
return_df,
run_config={
"solids": {"return_df": {"inputs": {"input_df": {file_type: {"path": file_name}}}}}
},
)
assert result.success
assert assert_eq(result.output_value(), create_dask_df())

read_result = execute_solid(
return_df,
Expand All @@ -62,18 +66,22 @@ def test_dataframe_outputs(file_type, read, kwargs):
def return_df(_):
return df

with get_temp_dir() as temp_path:
shutil.rmtree(temp_path)
result = execute_solid(
return_df,
run_config={
"solids": {
"return_df": {
"outputs": [{"output_df": {file_type: {"path": temp_path, **kwargs}}}]
with pytest.warns(
"Specifying {key}: is deprecated. Use to:{key}: instead.".format(key=file_type)
UserWarning,
):
with get_temp_dir() as temp_path:
shutil.rmtree(temp_path)
result = execute_solid(
return_df,
run_config={
"solids": {
"return_df": {
"outputs": [{"output_df": {file_type: {"path": temp_path, **kwargs}}}]
}
}
}
},
)
assert result.success
actual = read(f"{temp_path}/*")
assert assert_eq(actual, df)
},
)
assert result.success
actual = read(f"{temp_path}/*")
assert assert_eq(actual, df)

0 comments on commit 16c22fc

Please sign in to comment.