@@ -85,15 +85,21 @@ def current_client_token(admin_client: DynamicClient) -> str:
8585
8686@pytest .fixture (scope = "session" )
8787def teardown_resources (pytestconfig : pytest .Config ) -> bool :
88- if delete_pre_upgrade_resources := pytestconfig .option .delete_pre_upgrade_resources :
89- LOGGER .warning ("Resources will be deleted" )
88+ delete_resources = True
9089
91- return delete_pre_upgrade_resources
90+ if pytestconfig .option .pre_upgrade :
91+ if delete_resources := pytestconfig .option .delete_pre_upgrade_resources :
92+ LOGGER .warning ("Upgrade resources will be deleted" )
93+
94+ return delete_resources
9295
9396
9497@pytest .fixture (scope = "class" )
9598def model_namespace (
96- request : FixtureRequest , pytestconfig : pytest .Config , admin_client : DynamicClient , teardown_resources : bool
99+ request : FixtureRequest ,
100+ pytestconfig : pytest .Config ,
101+ admin_client : DynamicClient ,
102+ teardown_resources : bool ,
97103) -> Generator [Namespace , Any , Any ]:
98104 if request .param .get ("modelmesh-enabled" ):
99105 request .getfixturevalue (argname = "enabled_modelmesh_in_dsc" )
@@ -104,7 +110,11 @@ def model_namespace(
104110 yield ns
105111 ns .clean_up ()
106112 else :
107- with create_ns (admin_client = admin_client , pytest_request = request , teardown = teardown_resources ) as ns :
113+ with create_ns (
114+ admin_client = admin_client ,
115+ pytest_request = request ,
116+ teardown = teardown_resources ,
117+ ) as ns :
108118 yield ns
109119
110120
0 commit comments