diff --git a/backend/tests/test_property.py b/backend/tests/test_property.py index 7f7cc140..776c1491 100644 --- a/backend/tests/test_property.py +++ b/backend/tests/test_property.py @@ -110,7 +110,7 @@ class TestProperty: return property_instance - @pytest.fixture + @pytest.fixture() def mock_cleaner(self): lighting_averages = [ {'lighting-description': 'good lighting efficiency', 'low-energy-lighting': 99.26666666666667}, diff --git a/etl/epc/tests/test_epcrecord.py b/etl/epc/tests/test_epcrecord.py index 37a00cd4..39e1ee60 100644 --- a/etl/epc/tests/test_epcrecord.py +++ b/etl/epc/tests/test_epcrecord.py @@ -1,3 +1,4 @@ +import pickle import pytest from utils.s3 import read_dataframe_from_s3_parquet from etl.epc.Record import EPCRecord @@ -9,11 +10,10 @@ class TestEpcRecord: @pytest.fixture() def cleaning_data(self): - cleaning_data = read_dataframe_from_s3_parquet( - bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet", - ) + with open("recommendations/tests/test_data/cleaning_data.pkl", "rb") as f: + data = pickle.load(f) - return cleaning_data + return data @pytest.fixture() def epc_records_1(self): @@ -262,7 +262,7 @@ class TestEpcRecord: record.full_sap_epc = [] record._clean_number_lighting_outlets() - assert record.prepared_epc["fixed-lighting-outlets-count"] == 8.0 + assert record.prepared_epc["fixed-lighting-outlets-count"] == 10 def test_clean_count_variables(self, cleaning_data): record = EPCRecord(cleaning_data=cleaning_data) diff --git a/recommendations/tests/test_data/cleaned.pkl b/recommendations/tests/test_data/cleaned.pkl new file mode 100644 index 00000000..c18c8b08 Binary files /dev/null and b/recommendations/tests/test_data/cleaned.pkl differ diff --git a/recommendations/tests/test_data/cleaning_data.pkl b/recommendations/tests/test_data/cleaning_data.pkl new file mode 100644 index 00000000..b5a4ac20 Binary files /dev/null and b/recommendations/tests/test_data/cleaning_data.pkl differ diff --git a/recommendations/tests/test_heating_recommendations.py b/recommendations/tests/test_heating_recommendations.py index b1ac4d18..039801e1 100644 --- a/recommendations/tests/test_heating_recommendations.py +++ b/recommendations/tests/test_heating_recommendations.py @@ -1,7 +1,6 @@ from datetime import datetime import pandas as pd -import msgpack -from utils.s3 import read_dataframe_from_s3_parquet, read_from_s3 +import pickle import pytest from backend.Property import Property from etl.epc.Record import EPCRecord @@ -12,23 +11,21 @@ from recommendations.tests.test_data.heating_recommendations_data import testing class TestHeatingRecommendations: - @pytest.fixture + @pytest.fixture() def cleaning_data(self): - return read_dataframe_from_s3_parquet( - bucket_name="retrofit-data-dev", file_key="sap_change_model/cleaning_dataset.parquet", - ) + with open("recommendations/tests/test_data/cleaning_data.pkl", "rb") as f: + data = pickle.load(f) - @pytest.fixture + return data + + @pytest.fixture() def cleaned(self): - df = read_from_s3( - s3_file_name="cleaned_epc_data/cleaned.bson", - bucket_name="retrofit-data-dev" - ) + with open("recommendations/tests/test_data/cleaned.pkl", "rb") as f: + df = pickle.load(f) - df = msgpack.unpackb(df, raw=False) return df - @pytest.fixture + @pytest.fixture() def kwh_client(self): client = KwhData(bucket="retrofit-data-dev", read_consumption_data=False) # We fix this pricing table for these tests