VibecoderMcSwaggins commited on
Commit
2ff16a3
·
1 Parent(s): a46131e

fix: address CodeRabbit feedback and CI failure

Browse files

- Mock check_magentic_requirements in tests to run without OPENAI_API_KEY
- Update stale "biorxiv" comment in models.py per CodeRabbit suggestion

CI was failing because MagenticOrchestrator requires OPENAI_API_KEY,
which exists locally in .env but not in CI environment.

src/utils/models.py CHANGED
@@ -5,7 +5,7 @@ from typing import Any, ClassVar, Literal
5
 
6
  from pydantic import BaseModel, Field
7
 
8
- # Centralized source type - add new sources here (e.g., "biorxiv" in Phase 11)
9
  SourceName = Literal["pubmed", "clinicaltrials", "europepmc", "preprint"]
10
 
11
 
 
5
 
6
  from pydantic import BaseModel, Field
7
 
8
+ # Centralized source type - add new sources here (e.g., new databases)
9
  SourceName = Literal["pubmed", "clinicaltrials", "europepmc", "preprint"]
10
 
11
 
tests/unit/test_magentic_fix.py CHANGED
@@ -2,6 +2,7 @@
2
 
3
  from unittest.mock import MagicMock, patch
4
 
 
5
  from agent_framework import MagenticFinalResultEvent
6
 
7
  from src.orchestrator_magentic import MagenticOrchestrator
@@ -31,10 +32,17 @@ class MockChatMessage:
31
  return "<ChatMessage object at 0xMOCK>"
32
 
33
 
 
 
 
 
 
 
 
34
  class TestMagenticFixes:
35
  """Tests for the Magentic mode fixes."""
36
 
37
- def test_process_event_extracts_text_correctly(self) -> None:
38
  """
39
  Test that _process_event correctly extracts text from a ChatMessage.
40
 
@@ -54,7 +62,7 @@ class TestMagenticFixes:
54
  assert result_event.type == "complete"
55
  assert result_event.message == "Final Report Content"
56
 
57
- def test_max_rounds_configuration(self) -> None:
58
  """Test that max_rounds is correctly passed to the orchestrator."""
59
  orchestrator = MagenticOrchestrator(max_rounds=25)
60
  assert orchestrator._max_rounds == 25
 
2
 
3
  from unittest.mock import MagicMock, patch
4
 
5
+ import pytest
6
  from agent_framework import MagenticFinalResultEvent
7
 
8
  from src.orchestrator_magentic import MagenticOrchestrator
 
32
  return "<ChatMessage object at 0xMOCK>"
33
 
34
 
35
+ @pytest.fixture
36
+ def mock_magentic_requirements():
37
+ """Mock the API key check so tests run in CI without OPENAI_API_KEY."""
38
+ with patch("src.orchestrator_magentic.check_magentic_requirements"):
39
+ yield
40
+
41
+
42
  class TestMagenticFixes:
43
  """Tests for the Magentic mode fixes."""
44
 
45
+ def test_process_event_extracts_text_correctly(self, mock_magentic_requirements) -> None:
46
  """
47
  Test that _process_event correctly extracts text from a ChatMessage.
48
 
 
62
  assert result_event.type == "complete"
63
  assert result_event.message == "Final Report Content"
64
 
65
+ def test_max_rounds_configuration(self, mock_magentic_requirements) -> None:
66
  """Test that max_rounds is correctly passed to the orchestrator."""
67
  orchestrator = MagenticOrchestrator(max_rounds=25)
68
  assert orchestrator._max_rounds == 25