Skip to content

Commit 520f389

Browse files
committed
test(siliconflow): add real release coverage
1 parent 4a5a4b7 commit 520f389

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ Each release-gated test class is `skipif`-gated on the env vars its provider nee
162162
| OpenRouter | `OPENROUTER_API_KEY` |
163163
| Perplexity | `PERPLEXITY_API_KEY` (note: tool-calling tests skip — Perplexity API doesn't support tools) |
164164
| MiniMax | `MINIMAX_API_KEY` |
165+
| SiliconFlow | `SILICONFLOW_API_KEY` |
165166
| DashScope (Qwen) | `DASHSCOPE_API_KEY` |
166167
| Jina | `JINA_API_KEY` |
167168
| Voyage | `VOYAGE_API_KEY` |

tests/integration/test_chat_completion_real.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,59 @@ async def test_async_streaming(self):
751751
assert len(total_content) > 0
752752

753753

754+
# =============================================================================
755+
# SiliconFlow Tests
756+
# =============================================================================
757+
758+
759+
@pytest.mark.release
760+
@pytest.mark.skipif(
761+
not os.getenv("SILICONFLOW_API_KEY"),
762+
reason="SILICONFLOW_API_KEY not configured",
763+
)
764+
class TestSiliconFlowChat:
765+
"""Real integration tests for SiliconFlow chat and model discovery."""
766+
767+
MODEL = "deepseek-ai/DeepSeek-V3.1-Terminus"
768+
769+
def test_sync_chat_complete(self):
770+
model = AIFactory.create_language("siliconflow", self.MODEL)
771+
response = model.chat_complete(messages=MESSAGES)
772+
assert isinstance(response, ChatCompletion)
773+
assert response.choices[0].message.content
774+
775+
async def test_async_chat_complete(self):
776+
model = AIFactory.create_language("siliconflow", self.MODEL)
777+
response = await model.achat_complete(messages=MESSAGES)
778+
assert isinstance(response, ChatCompletion)
779+
assert response.choices[0].message.content
780+
781+
def test_sync_streaming(self):
782+
model = AIFactory.create_language("siliconflow", self.MODEL)
783+
response = model.chat_complete(messages=MESSAGES, stream=True)
784+
total_content = ""
785+
for chunk in response:
786+
assert isinstance(chunk, ChatCompletionChunk)
787+
if chunk.choices[0].delta.content:
788+
total_content += chunk.choices[0].delta.content
789+
assert total_content
790+
791+
async def test_async_streaming(self):
792+
model = AIFactory.create_language("siliconflow", self.MODEL)
793+
response = await model.achat_complete(messages=MESSAGES, stream=True)
794+
total_content = ""
795+
async for chunk in response:
796+
assert isinstance(chunk, ChatCompletionChunk)
797+
if chunk.choices[0].delta.content:
798+
total_content += chunk.choices[0].delta.content
799+
assert total_content
800+
801+
def test_model_discovery(self):
802+
models = AIFactory.get_provider_models("siliconflow")
803+
assert models
804+
assert any(model.id == self.MODEL for model in models)
805+
806+
754807
# =============================================================================
755808
# MiniMax Tests
756809
# =============================================================================

0 commit comments

Comments
 (0)