测试无 skipped:integration 标记化(pytest.ini + @mark.integration + make test/test-integration 分工)

This commit is contained in:
Q.Sui
2026-08-14 21:25:26 +08:00
parent 3561a29cf3
commit 5af58ce9f7
4 changed files with 14 additions and 4 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
- name: Install pytest
run: python3 -m pip install pytest
- name: Run tests
run: python3 -m pytest tests/ -q
run: python3 -m pytest tests/ -q -m "not integration"
archive:
name: Build archive
+5 -2
View File
@@ -30,7 +30,10 @@ check: ## 改表后验证(schema 校验 + 数据检查)
@bash tests/check.sh
# ── 测试 ──
test: ## 运行全部 python 测试(规则引擎:因子/断语/agent_cli 分派)
python3 -m pytest tests/ -q
test: ## 运行 python 单测(规则引擎:因子/断语/agent_cli 分派;integration 由服务已起阶段跑)
python3 -m pytest tests/ -q -m "not integration"
test-integration: ## 全链路集成测试(需引擎服务:LIKI_RPC_URL 指向引擎 /jsonrpc)
python3 -m pytest tests/ -q -m integration
test-all: test ## 全量(当前 = test;后续加 lint/archive 校验)
+3
View File
@@ -0,0 +1,3 @@
[pytest]
markers =
integration: 需真实引擎服务(服务已起阶段执行;无服务阶段 -m "not integration" 排除)
+5 -1
View File
@@ -7,6 +7,8 @@ import sys
import unittest
from unittest import mock
import pytest
sys.path.insert(0, __import__('os').path.join(
__import__('os').path.dirname(__import__('os').path.abspath(__file__)), '..', 'tools'))
@@ -136,9 +138,11 @@ class TestSchemaConsistency(unittest.TestCase):
agent_cli._dispatch(n, {"rule": "marriage", "snapshots": {}})
@pytest.mark.integration
class TestIntegration_FullChain(unittest.TestCase):
"""全链路集成测试:full_paipan→liunian→make_liunian_factors→query。
依赖真实引擎(LIKI_RPC_URL),不可达时跳过——CI/无引擎环境不挂。"""
依赖真实引擎(LIKI_RPC_URL)。由服务已起的阶段执行(make test-all Docker 段/部署验收),
无服务阶段用 -m 'not integration' 排除(不显示 skipped)。"""
def test_full_chain(self):
import os