2424import pytest
2525from google .protobuf .duration_pb2 import Duration
2626from mock import MagicMock , patch
27+ from pytest_lazyfixture import lazy_fixture
2728from pytz import timezone
2829
2930from feast .client import Client
@@ -253,7 +254,7 @@ def client(self, core_server, serving_server):
253254
254255 @pytest .mark .parametrize (
255256 "mocked_client" ,
256- [pytest . lazy_fixture ("mock_client" ), pytest . lazy_fixture ("secure_mock_client" )],
257+ [lazy_fixture ("mock_client" ), lazy_fixture ("secure_mock_client" )],
257258 )
258259 def test_version (self , mocked_client , mocker ):
259260 mocked_client ._core_service_stub = Core .CoreServiceStub (
@@ -286,10 +287,10 @@ def test_version(self, mocked_client, mocker):
286287 @pytest .mark .parametrize (
287288 "mocked_client,auth_metadata" ,
288289 [
289- (pytest . lazy_fixture ("mock_client" ), ()),
290- (pytest . lazy_fixture ("mock_client_with_auth" ), (AUTH_METADATA )),
291- (pytest . lazy_fixture ("secure_mock_client" ), ()),
292- (pytest . lazy_fixture ("secure_mock_client_with_auth" ), (AUTH_METADATA )),
290+ (lazy_fixture ("mock_client" ), ()),
291+ (lazy_fixture ("mock_client_with_auth" ), (AUTH_METADATA )),
292+ (lazy_fixture ("secure_mock_client" ), ()),
293+ (lazy_fixture ("secure_mock_client_with_auth" ), (AUTH_METADATA )),
293294 ],
294295 ids = [
295296 "mock_client_without_auth" ,
@@ -371,7 +372,7 @@ def int_val(x):
371372
372373 @pytest .mark .parametrize (
373374 "mocked_client" ,
374- [pytest . lazy_fixture ("mock_client" ), pytest . lazy_fixture ("secure_mock_client" )],
375+ [lazy_fixture ("mock_client" ), lazy_fixture ("secure_mock_client" )],
375376 )
376377 def test_get_feature_set (self , mocked_client , mocker ):
377378 mocked_client ._core_service_stub = Core .CoreServiceStub (
@@ -435,7 +436,7 @@ def test_get_feature_set(self, mocked_client, mocker):
435436
436437 @pytest .mark .parametrize (
437438 "mocked_client" ,
438- [pytest . lazy_fixture ("mock_client" ), pytest . lazy_fixture ("secure_mock_client" )],
439+ [lazy_fixture ("mock_client" ), lazy_fixture ("secure_mock_client" )],
439440 )
440441 def test_list_feature_sets (self , mocked_client , mocker ):
441442 mocker .patch .object (
@@ -496,7 +497,7 @@ def test_list_feature_sets(self, mocked_client, mocker):
496497
497498 @pytest .mark .parametrize (
498499 "mocked_client" ,
499- [pytest . lazy_fixture ("mock_client" ), pytest . lazy_fixture ("secure_mock_client" )],
500+ [lazy_fixture ("mock_client" ), lazy_fixture ("secure_mock_client" )],
500501 )
501502 def test_list_features (self , mocked_client , mocker ):
502503 mocker .patch .object (
@@ -542,7 +543,7 @@ def test_list_features(self, mocked_client, mocker):
542543
543544 @pytest .mark .parametrize (
544545 "mocked_client" ,
545- [pytest . lazy_fixture ("mock_client" ), pytest . lazy_fixture ("secure_mock_client" )],
546+ [lazy_fixture ("mock_client" ), lazy_fixture ("secure_mock_client" )],
546547 )
547548 def test_list_ingest_jobs (self , mocked_client , mocker ):
548549 mocker .patch .object (
@@ -598,7 +599,7 @@ def test_list_ingest_jobs(self, mocked_client, mocker):
598599
599600 @pytest .mark .parametrize (
600601 "mocked_client" ,
601- [pytest . lazy_fixture ("mock_client" ), pytest . lazy_fixture ("secure_mock_client" )],
602+ [lazy_fixture ("mock_client" ), lazy_fixture ("secure_mock_client" )],
602603 )
603604 def test_restart_ingest_job (self , mocked_client , mocker ):
604605 mocker .patch .object (
@@ -621,7 +622,7 @@ def test_restart_ingest_job(self, mocked_client, mocker):
621622
622623 @pytest .mark .parametrize (
623624 "mocked_client" ,
624- [pytest . lazy_fixture ("mock_client" ), pytest . lazy_fixture ("secure_mock_client" )],
625+ [lazy_fixture ("mock_client" ), lazy_fixture ("secure_mock_client" )],
625626 )
626627 def test_stop_ingest_job (self , mocked_client , mocker ):
627628 mocker .patch .object (
@@ -645,10 +646,10 @@ def test_stop_ingest_job(self, mocked_client, mocker):
645646 @pytest .mark .parametrize (
646647 "mocked_client" ,
647648 [
648- pytest . lazy_fixture ("mock_client" ),
649- pytest . lazy_fixture ("mock_client_with_auth" ),
650- pytest . lazy_fixture ("secure_mock_client" ),
651- pytest . lazy_fixture ("secure_mock_client_with_auth" ),
649+ lazy_fixture ("mock_client" ),
650+ lazy_fixture ("mock_client_with_auth" ),
651+ lazy_fixture ("secure_mock_client" ),
652+ lazy_fixture ("secure_mock_client_with_auth" ),
652653 ],
653654 )
654655 def test_get_historical_features (self , mocked_client , mocker ):
@@ -768,8 +769,7 @@ def test_get_historical_features(self, mocked_client, mocker):
768769 assert actual_dataframe [["driver_id" ]].equals (expected_dataframe [["driver_id" ]])
769770
770771 @pytest .mark .parametrize (
771- "test_client" ,
772- [pytest .lazy_fixture ("client" ), pytest .lazy_fixture ("secure_client" )],
772+ "test_client" , [lazy_fixture ("client" ), lazy_fixture ("secure_client" )],
773773 )
774774 def test_apply_feature_set_success (self , test_client ):
775775
@@ -813,8 +813,8 @@ def test_apply_feature_set_success(self, test_client):
813813 @pytest .mark .parametrize (
814814 "dataframe,test_client" ,
815815 [
816- (dataframes .GOOD , pytest . lazy_fixture ("client" )),
817- (dataframes .GOOD , pytest . lazy_fixture ("secure_client" )),
816+ (dataframes .GOOD , lazy_fixture ("client" )),
817+ (dataframes .GOOD , lazy_fixture ("secure_client" )),
818818 ],
819819 )
820820 def test_feature_set_ingest_success (self , dataframe , test_client , mocker ):
@@ -845,7 +845,7 @@ def test_feature_set_ingest_success(self, dataframe, test_client, mocker):
845845
846846 @pytest .mark .parametrize (
847847 "dataframe,test_client,exception" ,
848- [(dataframes .GOOD , pytest . lazy_fixture ("client" ), Exception )],
848+ [(dataframes .GOOD , lazy_fixture ("client" ), Exception )],
849849 )
850850 def test_feature_set_ingest_throws_exception_if_kafka_down (
851851 self , dataframe , test_client , exception , mocker
@@ -878,8 +878,8 @@ def test_feature_set_ingest_throws_exception_if_kafka_down(
878878 @pytest .mark .parametrize (
879879 "dataframe,exception,test_client" ,
880880 [
881- (dataframes .GOOD , TimeoutError , pytest . lazy_fixture ("client" )),
882- (dataframes .GOOD , TimeoutError , pytest . lazy_fixture ("secure_client" )),
881+ (dataframes .GOOD , TimeoutError , lazy_fixture ("client" )),
882+ (dataframes .GOOD , TimeoutError , lazy_fixture ("secure_client" )),
883883 ],
884884 )
885885 def test_feature_set_ingest_fail_if_pending (
@@ -915,26 +915,22 @@ def test_feature_set_ingest_fail_if_pending(
915915 @pytest .mark .parametrize (
916916 "dataframe,exception,test_client" ,
917917 [
918- (dataframes .BAD_NO_DATETIME , Exception , pytest . lazy_fixture ("client" )),
918+ (dataframes .BAD_NO_DATETIME , Exception , lazy_fixture ("client" )),
919919 (
920920 dataframes .BAD_INCORRECT_DATETIME_TYPE ,
921921 Exception ,
922- pytest .lazy_fixture ("client" ),
923- ),
924- (dataframes .BAD_NO_ENTITY , Exception , pytest .lazy_fixture ("client" )),
925- (dataframes .NO_FEATURES , Exception , pytest .lazy_fixture ("client" )),
926- (
927- dataframes .BAD_NO_DATETIME ,
928- Exception ,
929- pytest .lazy_fixture ("secure_client" ),
922+ lazy_fixture ("client" ),
930923 ),
924+ (dataframes .BAD_NO_ENTITY , Exception , lazy_fixture ("client" )),
925+ (dataframes .NO_FEATURES , Exception , lazy_fixture ("client" )),
926+ (dataframes .BAD_NO_DATETIME , Exception , lazy_fixture ("secure_client" ),),
931927 (
932928 dataframes .BAD_INCORRECT_DATETIME_TYPE ,
933929 Exception ,
934- pytest . lazy_fixture ("secure_client" ),
930+ lazy_fixture ("secure_client" ),
935931 ),
936- (dataframes .BAD_NO_ENTITY , Exception , pytest . lazy_fixture ("secure_client" )),
937- (dataframes .NO_FEATURES , Exception , pytest . lazy_fixture ("secure_client" )),
932+ (dataframes .BAD_NO_ENTITY , Exception , lazy_fixture ("secure_client" )),
933+ (dataframes .NO_FEATURES , Exception , lazy_fixture ("secure_client" )),
938934 ],
939935 )
940936 def test_feature_set_ingest_failure (self , test_client , dataframe , exception ):
@@ -954,8 +950,8 @@ def test_feature_set_ingest_failure(self, test_client, dataframe, exception):
954950 @pytest .mark .parametrize (
955951 "dataframe,test_client" ,
956952 [
957- (dataframes .ALL_TYPES , pytest . lazy_fixture ("client" )),
958- (dataframes .ALL_TYPES , pytest . lazy_fixture ("secure_client" )),
953+ (dataframes .ALL_TYPES , lazy_fixture ("client" )),
954+ (dataframes .ALL_TYPES , lazy_fixture ("secure_client" )),
959955 ],
960956 )
961957 def test_feature_set_types_success (self , test_client , dataframe , mocker ):
0 commit comments