5858MODULE_NAME = inspect .getmodulename (__file__ )
5959
6060# Get file path for temporary config file
61- temp_config = Path (
62- os .path .join (os .path .abspath (__file__ ).split ("Framework" )[0 ])
63- / Path ("AutomationLog" )
64- / Path (
65- ConfigModule .get_config_value (
66- "Advanced Options" ,
67- "_file" ,
61+ def temp_config () -> Path :
62+ return Path (
63+ os .path .join (os .path .abspath (__file__ ).split ("Framework" )[0 ])
64+ / Path ("AutomationLog" )
65+ / Path (
66+ ConfigModule .get_config_value (
67+ "Advanced Options" ,
68+ "_file" ,
69+ )
6870 )
6971 )
70- )
7172
7273common_modules = ["os" , "sys" , "platform" , "time" , "datetime" , "random" , "re" , "uuid" , "pathlib" , "json" , "ast" , "yaml" , "csv" , "xml" , "xlwings" , "requests" , "sr" ]
7374
@@ -328,41 +329,6 @@ def prettify(key, val):
328329 # 4 means console log which is Magenta color in server console
329330 live_log_service .log ("VARIABLE" , 4 , expression .replace ("\n " , "<br>" ).replace (" " , " " ))
330331
331- def Add_Folder_To_Current_Test_Case_Log (src ):
332- try :
333- # get the current test case locations
334- dest_folder = ConfigModule .get_config_value (
335- "sectionOne" , "test_case_folder" , temp_config
336- )
337- folder_name = [x for x in src .split ("/" ) if x != "" ][- 1 ]
338- if folder_name :
339- des_path = os .path .join (dest_folder , folder_name )
340- FL .copy_folder (src , des_path )
341- return True
342- else :
343- return False
344-
345- except Exception as e :
346- return Exception_Handler (sys .exc_info ())
347-
348-
349- def Add_File_To_Current_Test_Case_Log (src ):
350- try :
351- # get the current test case locations
352- dest_folder = ConfigModule .get_config_value (
353- "sectionOne" , "test_case_folder" , temp_config
354- )
355- file_name = [x for x in src .split ("/" ) if x != "" ][- 1 ]
356- if file_name :
357- des_path = os .path .join (dest_folder , file_name )
358- FL .copy_file (src , des_path )
359- return True
360- else :
361- return False
362-
363- except Exception as e :
364- return Exception_Handler (sys .exc_info ())
365-
366332
367333def strip1 (original_value : str , remove : str ) -> str :
368334 if original_value .startswith (remove ):
@@ -476,7 +442,7 @@ def CreateJsonReport(logs=None, stepInfo=None, TCInfo=None, setInfo=None):
476442 global all_logs_json , report_json_time , tc_error_logs , passed_after_rerun , zeuz_tc_run_comment
477443 start = time .perf_counter ()
478444 if logs or stepInfo or TCInfo or setInfo :
479- log_id = ConfigModule .get_config_value ("sectionOne" , "sTestStepExecLogId" , temp_config )
445+ log_id = ConfigModule .get_config_value ("sectionOne" , "sTestStepExecLogId" , temp_config () )
480446 # 'Wed-May-6-08:11:59-2026|TEST-0158|none|none'
481447 if setInfo :
482448 print ('\n \n ------ Set report investigation ------\n \n ' )
@@ -493,8 +459,8 @@ def CreateJsonReport(logs=None, stepInfo=None, TCInfo=None, setInfo=None):
493459 "_file" ,
494460 )
495461 print ('advanced_options_file:' , advanced_options_file )
496- print ('temp_config:' , temp_config )
497- with open (temp_config , 'r' ) as f :
462+ print ('temp_config:' , temp_config () )
463+ with open (temp_config () , 'r' ) as f :
498464 print ('\n \n ' , f .read (), '\n \n ' )
499465
500466 print ('\n \n --------------------------------------\n \n ' )
@@ -716,15 +682,15 @@ def ExecLog(
716682 if iLogLevel > 0 :
717683 if iLogLevel == 6 :
718684 FWLogFolder = ConfigModule .get_config_value (
719- "sectionOne" , "log_folder" , temp_config
685+ "sectionOne" , "log_folder" , temp_config ()
720686 )
721687 if os .path .exists (FWLogFolder ) == False :
722688 FL .CreateFolder (FWLogFolder ) # Create log directory if missing
723689
724690 if FWLogFolder == "" :
725691 BrowserConsoleLogFile = (
726692 ConfigModule .get_config_value (
727- "sectionOne" , "temp_run_file_path" , temp_config
693+ "sectionOne" , "temp_run_file_path" , temp_config ()
728694 )
729695 + os .sep
730696 + "BrowserLog.log"
@@ -777,7 +743,7 @@ def ExecLog(
777743
778744
779745 log_id = ConfigModule .get_config_value (
780- "sectionOne" , "sTestStepExecLogId" , temp_config
746+ "sectionOne" , "sTestStepExecLogId" , temp_config ()
781747 )
782748 if not log_id :
783749 return
@@ -805,7 +771,7 @@ def ExecLog(
805771 filepath = (
806772 Path (
807773 ConfigModule .get_config_value (
808- "sectionOne" , "temp_run_file_path" , temp_config
774+ "sectionOne" , "temp_run_file_path" , temp_config ()
809775 )
810776 )
811777 / "execution.log"
@@ -910,7 +876,7 @@ def TakeScreenShot(function_name, local_run=False):
910876 sModuleInfo = inspect .currentframe ().f_code .co_name + " : " + MODULE_NAME
911877 # Read values from config file
912878 take_screenshot_settings = ConfigModule .get_config_value ("RunDefinition" , "take_screenshot" )
913- image_folder = ConfigModule .get_config_value ("sectionOne" , "screen_capture_folder" , temp_config )
879+ image_folder = ConfigModule .get_config_value ("sectionOne" , "screen_capture_folder" , temp_config () )
914880
915881 try :
916882 if not os .path .exists (image_folder ):
0 commit comments