55
66import sys
77import os
8+ import pytest
89
910# Add the parent directory to the Python path for development testing
1011sys .path .insert (0 , os .path .join (os .path .dirname (__file__ ), '..' ))
@@ -28,7 +29,7 @@ def create_trace_reader():
2829 )
2930 if not os .path .exists (data_file ):
3031 return None
31- return lcs .open_trace (data_file , lcs .TraceType .ORACLE_GENERAL_TRACE . value )
32+ return lcs .open_trace (data_file , lcs .TraceType .ORACLE_GENERAL_TRACE )
3233
3334
3435def test_process_trace_native ():
@@ -38,8 +39,7 @@ def test_process_trace_native():
3839 # Open trace
3940 reader = create_trace_reader ()
4041 if reader is None :
41- print ("Warning: Test trace file not found, skipping test" )
42- return # Skip test
42+ pytest .skip ("Test trace file not found, skipping test" )
4343
4444 # Create LRU cache
4545 cache = lcs .LRU (1024 * 1024 ) # 1MB cache
@@ -61,8 +61,7 @@ def test_process_trace_python_hook():
6161 # Open trace
6262 reader = create_trace_reader ()
6363 if reader is None :
64- print ("Warning: Test trace file not found, skipping test" )
65- return # Skip test
64+ pytest .skip ("Test trace file not found, skipping test" )
6665
6766 # Create Python hook LRU cache
6867 cache = lcs .PythonHookCachePolicy (1024 * 1024 , "TestLRU" )
@@ -126,8 +125,7 @@ def test_compare_native_vs_python_hook():
126125 native_cache = lcs .LRU (cache_size )
127126 reader1 = create_trace_reader ()
128127 if reader1 is None :
129- print ("Warning: Test trace file not found, skipping test" )
130- return # Skip test
128+ pytest .skip ("Test trace file not found, skipping test" )
131129
132130 native_miss_ratio = native_cache .process_trace (reader1 , max_req = max_requests )
133131
@@ -175,8 +173,7 @@ def test_error_handling():
175173
176174 reader = create_trace_reader ()
177175 if reader is None :
178- print ("Warning: Test trace file not found, skipping error test" )
179- return # Skip test
176+ pytest .skip ("Test trace file not found, skipping error test" )
180177
181178 # Try to process trace without setting hooks
182179 try :
@@ -199,8 +196,7 @@ def test_lru_implementation_accuracy():
199196 reader2 = create_trace_reader ()
200197
201198 if not reader1 or not reader2 :
202- print ("Warning: Cannot open trace files for LRU accuracy test" )
203- return
199+ pytest .skip ("Cannot open trace files for LRU accuracy test" )
204200
205201 # Test native LRU
206202 native_cache = lcs .LRU (cache_size )
0 commit comments