13 lines
426 B
Python
13 lines
426 B
Python
|
|
"""清理夹具只能运行在显式指定的独立测试库中。"""
|
||
|
|
|
||
|
|
import re
|
||
|
|
|
||
|
|
|
||
|
|
def ensure_test_database(database: str, expected: str | None) -> None:
|
||
|
|
if (
|
||
|
|
not expected
|
||
|
|
or database != expected
|
||
|
|
or not re.fullmatch(r"payroll_(?:wbtest|test)_[0-9a-f]{8,32}", database)
|
||
|
|
):
|
||
|
|
raise RuntimeError("拒绝清理非隔离测试库:请通过隔离测试运行器设置 PAYROLL_TEST_DATABASE")
|