@@ -30,23 +30,6 @@ def load_env():
3030 load_dotenv ()
3131
3232
33- @pytest .fixture (scope = "session" )
34- def root_integration_directory (humanloop_client : Humanloop ) -> Generator [str , None , None ]:
35- try :
36- response = humanloop_client .directories .create (path = "SDK_INTEGRATION_TESTS" )
37- except Exception :
38- list_dirs = humanloop_client .directories .list ()
39- for directory in list_dirs :
40- if directory .path == "SDK_INTEGRATION_TESTS" :
41- _directory_cleanup (directory .id , humanloop_client )
42- response = humanloop_client .directories .create (path = "SDK_INTEGRATION_TESTS" )
43- try :
44- yield response .path
45- finally :
46- time .sleep (1 )
47- _directory_cleanup (response .id , humanloop_client )
48-
49-
5033@pytest .fixture (scope = "session" )
5134def api_keys () -> APIKeys :
5235 openai_key = os .getenv ("OPENAI_API_KEY" )
@@ -107,14 +90,13 @@ class DirectoryIdentifiers:
10790
10891@pytest .fixture ()
10992def test_directory (
110- root_integration_directory : str ,
11193 humanloop_client : Humanloop ,
11294) -> Generator [DirectoryIdentifiers , None , None ]:
11395 # Generate a random alphanumeric directory name to avoid conflicts
114- def get_random_string (length : int = 32 ) -> str :
115- return "" .join ([random .choice (string .ascii_letters ) for _ in range (length )])
96+ def get_random_string (length : int = 16 ) -> str :
97+ return "" .join ([random .choice (string .ascii_letters + "0123456789" ) for _ in range (length )])
11698
117- directory_path = f" { root_integration_directory } / { get_random_string ()} "
99+ directory_path = "SDK_integ_test_" + get_random_string ()
118100 response = humanloop_client .directories .create (path = directory_path )
119101 assert response .path == directory_path
120102 try :
0 commit comments