"""Explicit non-learning PhysX gate; a skip is not physical evidence.""" import json import os import subprocess import sys from pathlib import Path import pytest ROOT = Path(__file__).resolve().parents[1] @pytest.mark.skipif(os.environ.get('SIM_RESIDUAL_RUNTIME_TESTS') != '1', reason='requires supervised Isaac PhysX') def test_real_nominal_reference_residual(tmp_path): env = os.environ.copy() env.pop('CONDA_PREFIX', None) env.pop('VIRTUAL_ENV', None) env['PYTHONPATH'] = str(ROOT / 'source/SkillFactory') lab = env.get('ISAACLAB_LAUNCHER', '/home/cen/IsaacLab/isaaclab.sh') process = subprocess.run([ sys.executable, str(ROOT / 'scripts/supervise_sim.py'), '--timeout', '240', '--log', str(tmp_path / 'kit.log'), '--report', str(tmp_path / 'process.json'), '--', lab, '-p', str(ROOT / 'scripts/verify_cycle_sim_residual.py'), '--output', str(tmp_path / 'trial'), '--headless', ], cwd=ROOT, env=env, capture_output=True, text=True, timeout=270) assert process.returncode == 0, process.stdout[-3000:] + process.stderr[-3000:] result = json.loads((tmp_path / 'trial/result.json').read_text()) supervisor = json.loads((tmp_path / 'process.json').read_text()) assert result['passed'] and result['sim_functional_passed'] and not result['accepted_skill'] assert result['optimizer_steps'] == 0 and not result['trained_residual_policy'] assert result['max_actual_residual_rad'] <= .050001 assert supervisor['passed'] and supervisor['cleanup']['clean'] and not supervisor['critical_log_lines']