akg-factor-bridge/test_daily_plan_contracts.py

32 lines
1.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""本地离线:python ../tradingSystem/scripts/unit_test_guard.py test_daily_plan_contracts.py。
统一 unittest 入口,复用已有断言组;缺席驱动与 HTTP 框架用替身,禁止联网。
"""
import importlib
import unittest
import test_plan_versions
import test_api_support # noqa: F401
def main():
suite = unittest.TestSuite()
for name in ('test_plan_versions', 'test_plan_reviews_live', 'test_plan_review_source', 'test_plan_stock_check',
'test_plan_rank_switch'):
suite.addTests(unittest.defaultTestLoader.loadTestsFromModule(importlib.import_module(name)))
for name in ('test_plan_cache', 'test_plan_snapshot', 'test_plan_rank_axis',
'test_plan_quality_rank', 'test_plan_verdict', 'test_plan_logic_state',
'test_plan_review_heads', 'test_plan_review_window', 'test_review_latest',
'test_review_targets', 'test_card', 'test_company_quality'):
mod = importlib.import_module(name)
funcs = [mod.main] if hasattr(mod, 'main') else [getattr(mod, n) for n in sorted(dir(mod)) if n.startswith('test_')]
for fn in funcs:
def run(fn=fn):
assert fn() in (None, 0), fn.__module__
suite.addTest(unittest.FunctionTestCase(run, description=name + '.' + fn.__name__))
result = unittest.TextTestRunner(verbosity=2).run(suite)
raise SystemExit(0 if result.wasSuccessful() else 1)
if __name__ == '__main__':
main()