Files
easy-tdx/tests/integration/test_live_client.py
T
GitHubandClaude Opus 4.7 50491f9aae feat!: rename project from xmtdx to easy-tdx
- Package directory: src/xmtdx/ -> src/easy_tdx/
- Import path: from easy_tdx import ...
- pip install easy-tdx
- Add LICENSE (MIT) with upstream attribution (pytdx, xmtdx)
- Add NOTICE with detailed attribution
- Update all examples, tests, scripts, docs
- Bump version to 1.0.0

BREAKING CHANGE: import path changed from `xmtdx` to `easy_tdx`

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 23:21:21 +08:00

37 lines
952 B
Python

"""真实通达信服务器 smoke test。
默认跳过;设置 XMTDX_LIVE=1 后执行。
"""
from __future__ import annotations
import asyncio
import os
import pytest
from easy_tdx import AsyncTdxClient, Market, TdxClient
_LIVE_ENABLED = os.getenv("XMTDX_LIVE") == "1"
_LIVE_HOST = os.getenv("XMTDX_HOST", "180.153.18.170")
pytestmark = pytest.mark.skipif(
not _LIVE_ENABLED,
reason="set XMTDX_LIVE=1 to run live integration tests",
)
def test_sync_live_smoke() -> None:
with TdxClient(_LIVE_HOST, timeout=5.0) as client:
assert client.get_security_count(Market.SH) > 0
assert client.get_security_count(Market.SZ) > 0
def test_async_live_smoke() -> None:
async def main() -> None:
async with AsyncTdxClient(_LIVE_HOST, timeout=5.0) as client:
assert await client.get_security_count(Market.SH) > 0
assert await client.get_security_count(Market.SZ) > 0
asyncio.run(main())