import sys,tarfile,unittest,json
from pathlib import Path
root=Path('/tmp/baseline');root.mkdir()
with tarfile.open('/out/baseline_source.tar.gz') as f:f.extractall(root)
sys.path[:0]=[str(root),str(root/'tests')]
suite=unittest.defaultTestLoader.loadTestsFromName('test_fight_crowd_integration.IntegrationTests.test_web_fight_shared_pose_and_crowd_switch')
r=unittest.TextTestRunner(verbosity=2).run(suite)
Path('/out/download/baseline_contract_check.json').write_text(json.dumps(dict(passed=r.wasSuccessful(),tests=r.testsRun,failures=len(r.failures),errors=len(r.errors),scope='One pre-existing config projection test only; no baseline engine/cache replay')))
print('BASELINE_CONFIG_CHECK',r.wasSuccessful())
