Skip to content

Commit

Permalink
Remove teardown logic in tests as it s part of conftest
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Delacour <[email protected]>
  • Loading branch information
Matt Delacour committed Oct 15, 2021
1 parent 92819dd commit 5fea569
Showing 1 changed file with 20 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -563,34 +563,29 @@ def test_historical_features_from_bigquery_sources_containing_backfills(environm

store.apply([driver, driver_fv])

try:
offline_job = store.get_historical_features(
entity_df=entity_df,
features=["driver_stats:avg_daily_trips"],
full_feature_names=False,
)

start_time = datetime.utcnow()
actual_df = offline_job.to_df()
offline_job = store.get_historical_features(
entity_df=entity_df,
features=["driver_stats:avg_daily_trips"],
full_feature_names=False,
)

print(f"actual_df shape: {actual_df.shape}")
end_time = datetime.utcnow()
print(
str(f"Time to execute job_from_df.to_df() = '{(end_time - start_time)}'\n")
)
start_time = datetime.utcnow()
actual_df = offline_job.to_df()

assert sorted(expected_df.columns) == sorted(actual_df.columns)
assert_frame_equal(
expected_df.sort_values(by=["driver_id"]).reset_index(drop=True),
actual_df[expected_df.columns]
.sort_values(by=["driver_id"])
.reset_index(drop=True),
check_dtype=False,
)
print(f"actual_df shape: {actual_df.shape}")
end_time = datetime.utcnow()
print(
str(f"Time to execute job_from_df.to_df() = '{(end_time - start_time)}'\n")
)

finally:
store.teardown()
environment.data_source_creator.teardown()
assert sorted(expected_df.columns) == sorted(actual_df.columns)
assert_frame_equal(
expected_df.sort_values(by=["driver_id"]).reset_index(drop=True),
actual_df[expected_df.columns]
.sort_values(by=["driver_id"])
.reset_index(drop=True),
check_dtype=False,
)


def response_feature_name(feature: str, full_feature_names: bool) -> str:
Expand Down

0 comments on commit 5fea569

Please sign in to comment.