@@ -69,27 +69,30 @@ def generate_notebook_list(
69
69
class NotebookCatalogTest (unittest .TestCase ):
70
70
"""Contains test cases for catalog.notebook"""
71
71
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
-
86
72
@classmethod
87
73
def setUpClass (cls ) -> None :
88
74
os .environ [
89
75
"NB_SESSION_COMPARTMENT_OCID"
90
76
] = "ocid1.compartment.oc1.<unique_ocid>"
91
77
reload (ads .config )
92
78
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 ())
93
96
return super ().setUpClass ()
94
97
95
98
@classmethod
0 commit comments