@@ -31,14 +31,21 @@ def capture_test_output_with_timeout(cmd, timeout, env):
3131 stdout_data = b""
3232 stderr_data = b""
3333
34+ print (f"🔍 DEBUG: Platform detected: { sys .platform } " )
35+ print (f"🔍 DEBUG: Command to execute: { cmd } " )
36+ print (f"🔍 DEBUG: Timeout: { timeout } s" )
37+
3438 try :
3539 # Use Popen to capture output in real-time
40+ print ("🔍 DEBUG: Starting subprocess.Popen..." )
3641 process = subprocess .Popen (
3742 cmd , env = env , stdout = subprocess .PIPE , stderr = subprocess .PIPE , bufsize = 0 , universal_newlines = False
3843 )
44+ print (f"🔍 DEBUG: Process started with PID: { process .pid } " )
3945
4046 # Platform detection
4147 is_windows = sys .platform == "win32"
48+ print (f"🔍 DEBUG: is_windows={ is_windows } " )
4249
4350 if is_windows :
4451 # Windows: Use threading to read stdout/stderr concurrently
@@ -159,6 +166,11 @@ def read_output(pipe, queue_obj, output_stream):
159166 return process .returncode , stdout_data , stderr_data , False
160167
161168 except Exception as e :
169+ error_msg = f"❌ EXCEPTION in capture_test_output_with_timeout: { type (e ).__name__ } : { str (e )} "
170+ print (error_msg )
171+ import traceback
172+
173+ traceback .print_exc ()
162174 return - 1 , str (e ).encode (), b"" , False
163175
164176
@@ -209,6 +221,7 @@ def run_individual_tests(test_files, workspace_root, isaacsim_ci, windows_platfo
209221 if file_name in test_settings .PER_TEST_TIMEOUTS
210222 else test_settings .DEFAULT_TIMEOUT
211223 )
224+ print (f"⏱️ Timeout set to: { timeout } seconds" )
212225
213226 # Prepare command
214227 cmd = [
@@ -228,18 +241,26 @@ def run_individual_tests(test_files, workspace_root, isaacsim_ci, windows_platfo
228241 elif windows_platform :
229242 cmd .append ("-m" )
230243 cmd .append ("windows" )
244+ print ("🪟 Adding Windows marker filter to command" )
231245 elif arm_platform :
232246 cmd .append ("-m" )
233247 cmd .append ("arm" )
234248
235249 # Add the test file path last
236250 cmd .append (str (test_file ))
237251
252+ print (f"📝 Command: { ' ' .join (cmd )} " )
253+ print (f"📂 Working directory: { os .getcwd ()} " )
254+ print (f"🔧 Python executable: { sys .executable } " )
255+ print ("⏳ Starting test execution...\n " )
256+
238257 # Run test with timeout and capture output
239258 returncode , stdout_data , stderr_data , timed_out = capture_test_output_with_timeout (cmd , timeout , env )
240259
260+ print (f"\n ✅ Test execution completed. Return code: { returncode } , Timed out: { timed_out } " )
261+
241262 if timed_out :
242- print (f"Test { test_file } timed out after { timeout } seconds..." )
263+ print (f"⏱️ TIMEOUT: Test { test_file } timed out after { timeout } seconds..." )
243264 failed_tests .append (test_file )
244265
245266 # Create a special XML report for timeout tests with captured logs
@@ -250,6 +271,7 @@ def run_individual_tests(test_files, workspace_root, isaacsim_ci, windows_platfo
250271 # Write timeout report
251272 report_file = f"tests/test-reports-{ str (file_name )} .xml"
252273 timeout_report .write (report_file )
274+ print (f"📄 Timeout report written to: { report_file } " )
253275
254276 test_status [test_file ] = {
255277 "errors" : 1 ,
@@ -262,12 +284,28 @@ def run_individual_tests(test_files, workspace_root, isaacsim_ci, windows_platfo
262284 continue
263285
264286 if returncode != 0 :
287+ print (f"❌ Test returned non-zero exit code: { returncode } " )
288+ print (f"📤 STDOUT ({ len (stdout_data )} bytes):" )
289+ if stdout_data :
290+ print (stdout_data .decode ("utf-8" , errors = "replace" ))
291+ print (f"📤 STDERR ({ len (stderr_data )} bytes):" )
292+ if stderr_data :
293+ print (stderr_data .decode ("utf-8" , errors = "replace" ))
265294 failed_tests .append (test_file )
295+ else :
296+ print ("✅ Test returned exit code 0" )
266297
267298 # check report for any failures
268299 report_file = f"tests/test-reports-{ str (file_name )} .xml"
300+ print (f"🔍 Checking for report file: { report_file } " )
301+ print (f"🔍 Current working directory: { os .getcwd ()} " )
302+ print (f"🔍 tests/ directory exists: { os .path .exists ('tests/' )} " )
303+ if os .path .exists ("tests/" ):
304+ print (f"🔍 Contents of tests/ directory: { os .listdir ('tests/' )} " )
305+
269306 if not os .path .exists (report_file ):
270- print (f"Warning: Test report not found at { report_file } " )
307+ print (f"❌ WARNING: Test report not found at { report_file } " )
308+ print ("❌ This usually means pytest failed to run or crashed" )
271309 failed_tests .append (test_file )
272310 test_status [test_file ] = {
273311 "errors" : 1 , # Assume error since we can't read the report
@@ -279,8 +317,12 @@ def run_individual_tests(test_files, workspace_root, isaacsim_ci, windows_platfo
279317 }
280318 continue
281319
320+ print (f"✅ Report file found at { report_file } " )
321+
282322 try :
323+ print (f"📖 Parsing report file: { report_file } " )
283324 report = JUnitXml .fromfile (report_file )
325+ print ("📊 Report parsed successfully" )
284326
285327 # Rename test suites to be more descriptive
286328 for suite in report :
@@ -291,15 +333,24 @@ def run_individual_tests(test_files, workspace_root, isaacsim_ci, windows_platfo
291333
292334 # Write the updated report back
293335 report .write (report_file )
336+ print (f"💾 Updated report written back to: { report_file } " )
294337
295338 # Parse the integer values with None handling
296339 errors = int (report .errors ) if report .errors is not None else 0
297340 failures = int (report .failures ) if report .failures is not None else 0
298341 skipped = int (report .skipped ) if report .skipped is not None else 0
299342 tests = int (report .tests ) if report .tests is not None else 0
300343 time_elapsed = float (report .time ) if report .time is not None else 0.0
344+
345+ print (
346+ f"📊 Test results: errors={ errors } , failures={ failures } , skipped={ skipped } , tests={ tests } ,"
347+ f" time={ time_elapsed } s"
348+ )
301349 except Exception as e :
302- print (f"Error reading test report { report_file } : { e } " )
350+ print (f"❌ ERROR reading test report { report_file } : { type (e ).__name__ } : { e } " )
351+ import traceback
352+
353+ traceback .print_exc ()
303354 failed_tests .append (test_file )
304355 test_status [test_file ] = {
305356 "errors" : 1 ,
@@ -331,12 +382,19 @@ def run_individual_tests(test_files, workspace_root, isaacsim_ci, windows_platfo
331382
332383def pytest_sessionstart (session ):
333384 """Intercept pytest startup to execute tests in the correct order."""
385+ print ("\n " + "=" * 80 )
386+ print ("🚀 PYTEST SESSION START - Custom Test Runner" )
387+ print ("=" * 80 )
388+
334389 # Get the workspace root directory (one level up from tools)
335390 workspace_root = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
391+ print (f"📂 Workspace root: { workspace_root } " )
392+
336393 source_dirs = [
337394 os .path .join (workspace_root , "scripts" ),
338395 os .path .join (workspace_root , "source" ),
339396 ]
397+ print (f"📁 Source directories to scan: { source_dirs } " )
340398
341399 # Get filter pattern from environment variable or command line
342400 filter_pattern = os .environ .get ("TEST_FILTER_PATTERN" , "" )
@@ -397,23 +455,28 @@ def pytest_sessionstart(session):
397455 if isaacsim_ci :
398456 new_test_files = []
399457 for test_file in test_files :
400- with open (test_file , encoding = ' utf-8' ) as f :
458+ with open (test_file , encoding = " utf-8" ) as f :
401459 content = f .read ()
402460 if "@pytest.mark.isaacsim_ci" in content or "pytest.mark.isaacsim_ci" in content :
403461 new_test_files .append (test_file )
404462 test_files = new_test_files
405463 elif windows_platform :
464+ print ("🪟 Filtering tests for Windows platform..." )
406465 new_test_files = []
407466 for test_file in test_files :
408- with open (test_file , encoding = ' utf-8' ) as f :
467+ with open (test_file , encoding = " utf-8" ) as f :
409468 content = f .read ()
410469 if "@pytest.mark.windows" in content or "pytest.mark.windows" in content :
411470 new_test_files .append (test_file )
471+ print (f" ✓ Including: { test_file } " )
472+ else :
473+ print (f" ✗ Excluding (no windows marker): { test_file } " )
412474 test_files = new_test_files
475+ print (f"🪟 Windows filtering complete: { len (test_files )} tests selected" )
413476 elif arm_platform :
414477 new_test_files = []
415478 for test_file in test_files :
416- with open (test_file , encoding = ' utf-8' ) as f :
479+ with open (test_file , encoding = " utf-8" ) as f :
417480 content = f .read ()
418481 if "@pytest.mark.arm" in content or "pytest.mark.arm" in content :
419482 new_test_files .append (test_file )
0 commit comments