@@ -69,27 +69,30 @@ def generate_notebook_list(
6969class NotebookCatalogTest (unittest .TestCase ):
7070 """Contains test cases for catalog.notebook"""
7171
72- with patch .object (auth , "default_signer" ):
73- with patch .object (oci_client , "OCIClientFactory" ):
74- notebook_id = "ocid1.notebookcatalog.oc1.iad.<unique_ocid>"
75- comp_id = os .environ .get (
76- "NB_SESSION_COMPARTMENT_OCID" , "ocid1.compartment.oc1.iad.<unique_ocid>"
77- )
78- date_time = datetime (2020 , 7 , 1 , 18 , 24 , 42 , 110000 , tzinfo = timezone .utc )
79-
80- notebook_catalog = NotebookCatalog (compartment_id = comp_id )
81- notebook_catalog .ds_client = MagicMock ()
82- notebook_catalog .identity_client = MagicMock ()
83-
84- nsl = NotebookSummaryList (generate_notebook_list ())
85-
8672 @classmethod
8773 def setUpClass (cls ) -> None :
8874 os .environ [
8975 "NB_SESSION_COMPARTMENT_OCID"
9076 ] = "ocid1.compartment.oc1.<unique_ocid>"
9177 reload (ads .config )
9278 reload (ads .catalog .notebook )
79+ # Initialize class properties after reloading
80+ with patch .object (auth , "default_signer" ):
81+ with patch .object (oci_client , "OCIClientFactory" ):
82+ cls .notebook_id = "ocid1.notebookcatalog.oc1.iad.<unique_ocid>"
83+ cls .comp_id = os .environ .get (
84+ "NB_SESSION_COMPARTMENT_OCID" ,
85+ "ocid1.compartment.oc1.iad.<unique_ocid>" ,
86+ )
87+ cls .date_time = datetime (
88+ 2020 , 7 , 1 , 18 , 24 , 42 , 110000 , tzinfo = timezone .utc
89+ )
90+
91+ cls .notebook_catalog = NotebookCatalog (compartment_id = cls .comp_id )
92+ cls .notebook_catalog .ds_client = MagicMock ()
93+ cls .notebook_catalog .identity_client = MagicMock ()
94+
95+ cls .nsl = NotebookSummaryList (generate_notebook_list ())
9396 return super ().setUpClass ()
9497
9598 @classmethod
0 commit comments