#!/usr/bin/env python3 """使用随机测试用户/仓库验证真实 HTTPS Git 接入;不修改已有项目。""" import os from pathlib import Path import shlex import subprocess root = Path(__file__).resolve().parent.parent environment = os.environ.copy() config = root / '.env' if config.exists(): for line in config.read_text().splitlines(): if not line or line.startswith('#') or '=' not in line: continue key, value = line.split('=', 1) parsed = shlex.split(value) if parsed: environment[key] = parsed[0] if not environment.get('GITEA_TOKEN'): raise SystemExit('请配置 GITEA_BASE_URL、GITEA_ORGANIZATION 与可创建测试用户的 GITEA_TOKEN') if environment.get('DB_URL', '').startswith('jdbc:mysql:'): environment.setdefault('GIT_GATEWAY_MYSQL', 'true') environment.update(VIBEMAKE_LIVE_GITEA='true', AI_ENABLED='false', VIBEMAKE_AI_ENABLED='false', OSS_ENABLED='false') raise SystemExit(subprocess.call([ 'mvn', '-q', '-Dtest=GitGatewayLiveTest', '-Dsurefire.failIfNoSpecifiedTests=false', 'test' ], cwd=root, env=environment))