3030FLOAT_TOLERANCE = 0.00001
3131PROJECT_NAME = 'basic_' + uuid .uuid4 ().hex .upper ()[0 :6 ]
3232
33+
3334@pytest .fixture (scope = 'module' )
3435def core_url (pytestconfig ):
3536 return pytestconfig .getoption ("core_url" )
@@ -62,6 +63,7 @@ def client(core_url, serving_url, allow_dirty):
6263
6364 return client
6465
66+
6567def basic_dataframe (entities , features , ingest_time , n_size ):
6668 offset = random .randint (1000 , 100000 ) # ensure a unique key space is used
6769 df_dict = {
@@ -79,20 +81,29 @@ def basic_dataframe(entities, features, ingest_time, n_size):
7981def ingest_time ():
8082 return datetime .utcnow ()
8183
84+
8285@pytest .fixture (scope = "module" )
8386def cust_trans_df (ingest_time ):
8487 return basic_dataframe (entities = ["customer_id" ],
8588 features = ["daily_transactions" , "total_transactions" ],
8689 ingest_time = ingest_time ,
8790 n_size = 5 )
8891
92+
8993@pytest .fixture (scope = "module" )
9094def driver_df (ingest_time ):
9195 return basic_dataframe (entities = ["driver_id" ],
9296 features = ["rating" , "cost" ],
9397 ingest_time = ingest_time ,
9498 n_size = 5 )
9599
100+
101+ def test_version_returns_results (client ):
102+ version_info = client .version ()
103+ assert not version_info ['core' ] is 'not configured'
104+ assert not version_info ['serving' ] is 'not configured'
105+
106+
96107@pytest .mark .timeout (45 )
97108@pytest .mark .run (order = 10 )
98109def test_basic_register_feature_set_success (client ):
@@ -117,6 +128,7 @@ def test_basic_register_feature_set_success(client):
117128 # reset client's project for other tests
118129 client .set_project ()
119130
131+
120132@pytest .mark .timeout (300 )
121133@pytest .mark .run (order = 11 )
122134def test_basic_ingest_success (client , cust_trans_df , driver_df ):
@@ -157,16 +169,16 @@ def test_basic_retrieve_online_success(client, cust_trans_df):
157169
158170 returned_daily_transactions = float (
159171 response .field_values [0 ]
160- .fields ["daily_transactions" ]
161- .float_val
172+ .fields ["daily_transactions" ]
173+ .float_val
162174 )
163175 sent_daily_transactions = float (
164176 cust_trans_df .iloc [0 ]["daily_transactions" ])
165177
166178 if math .isclose (
167- sent_daily_transactions ,
168- returned_daily_transactions ,
169- abs_tol = FLOAT_TOLERANCE ,
179+ sent_daily_transactions ,
180+ returned_daily_transactions ,
181+ abs_tol = FLOAT_TOLERANCE ,
170182 ):
171183 break
172184
@@ -206,8 +218,8 @@ def test_basic_retrieve_online_multiple_featureset(client, cust_trans_df, driver
206218 def check_response (ingest_df , response , feature_ref ):
207219 returned_value = float (
208220 response .field_values [0 ]
209- .fields [feature_ref ]
210- .float_val
221+ .fields [feature_ref ]
222+ .float_val
211223 )
212224 feature_ref_splits = feature_ref .split (":" )
213225 if len (feature_ref_splits ) == 1 :
@@ -223,9 +235,11 @@ def check_response(ingest_df, response, feature_ref):
223235 returned_value ,
224236 abs_tol = FLOAT_TOLERANCE ,
225237 )
238+
226239 if all ([check_response (df , response , ref ) for ref , df in feature_ref_df_mapping ]):
227240 break
228241
242+
229243@pytest .mark .timeout (300 )
230244@pytest .mark .run (order = 19 )
231245def test_basic_ingest_jobs (client ):
0 commit comments