Files
cms-SiteForge/tests/test_regression_runner_v817.py
T
浅念 601451f22b upgrade: adopt V8.21.3 (V8.13→8.21.3: P5 SFTP/S3, P6 multilingual, editor overhaul, enterprise hardening)
Overlay ~150 upstream items onto our V8.12 base, preserving trade-pro
theme, registry tests, and design docs. Re-applied our patch set
(discovery/env_for/blocks.css/type-mapping/theme_color/frontend entries,
test_theme_pro_v3 mods) — all anchors survived upstream evolution.

New platform enhancement (fixes upgrade-introduced regression):
multilingual.site_locale now honors settings_json.locale, plus
PUT /api/i18n/sites/{id}/locale — standalone English sites get
<html lang='en'> under the V8.15 locale-rewrite pipeline.

compose: adopt V8.21.3 (image 8.21.3-dev.1, /api/ready probes, MySQL/S3
env) with project name pinned to siteforge-v8-10 (data volumes).

Tests: 356 passed / 11 failed — all 11 confirmed pre-existing in
pristine V8.21.3 on this host (10 upstream Windows env + our build test
now green after locale fix). Patch registry updated in plan doc.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-23 12:31:03 +08:00

48 lines
1.8 KiB
Python

"""V8.17 runner contract: artifacts never hide failures or timeouts."""
import importlib.util
import json
import os
import sys
from pathlib import Path
import pytest
PATH=Path(__file__).resolve().parents[1]/'scripts'/'regression_v817.py'
spec=importlib.util.spec_from_file_location('regression_v817',PATH)
m=importlib.util.module_from_spec(spec)
sys.modules[spec.name]=m
spec.loader.exec_module(m)
def test_clean_report(tmp_path):
r=m.Run('round1-batch1',['tests/test_example.py'],'PASS',1.25,0,4,str(tmp_path/'e.log'))
out=m.write_reports([r],tmp_path/'report',1,1)
assert out['status']=='PASS'
assert out['tests_last_complete_round']==4
assert (tmp_path/'report.html').read_text().startswith('<!doctype html>')
def test_failure_not_erased_by_diagnostic_retry(tmp_path):
original=m.Run('round1-batch1',['tests/test_example.py'],'TIMEOUT',1.0,None,0,str(tmp_path/'1.log'))
isolated=m.Run('round1-batch1-isolated-1',['tests/test_example.py'],'PASS',1.0,0,2,str(tmp_path/'2.log'))
out=m.write_reports([original,isolated],tmp_path/'report',1,1)
assert out['status']=='FAIL'
assert len(out['failures'])==1
assert json.loads((tmp_path/'report.json').read_text())['status']=='FAIL'
def test_runner_rejects_bad_parameters():
with pytest.raises(SystemExit) as exc:
m.main(['--repeat','0'])
assert exc.value.code==2
@pytest.mark.skipif(os.name=='nt',reason='POSIX signal process-group check')
def test_slow_pytest_process_times_out_and_is_reaped(tmp_path):
test=tmp_path/'test_slow_v817.py'
test.write_text('import time\ndef test_slow():\n time.sleep(15)\n')
out=m.run_pytest('unit-timeout',[str(test)],1,tmp_path,os.environ.copy())
assert out.status=='TIMEOUT'
assert out.seconds<7
assert 'TIMEOUT' in Path(out.log).read_text()