Skip to content

Commit 900af51

Browse files
juliomenendezclaude
andcommitted
fix: Update prompt suppression tests for processor-based suppression
Updates test_prompt_suppression.py to test suppress_invoke_agent_input on _EnrichingBatchSpanProcessor instead of _Agent365Exporter, reflecting the refactor that moved suppression to the processor layer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1e7aa8a commit 900af51

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

‎tests/observability/extensions/openai/test_prompt_suppression.py‎

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,42 @@
22
# Licensed under the MIT License.
33

44
import unittest
5+
from unittest.mock import Mock
56

6-
from microsoft_agents_a365.observability.core.exporters.agent365_exporter import _Agent365Exporter
7+
from microsoft_agents_a365.observability.core.exporters.enriching_span_processor import (
8+
_EnrichingBatchSpanProcessor,
9+
)
710

811

912
class TestPromptSuppressionConfiguration(unittest.TestCase):
1013
"""Unit tests for prompt suppression configuration in the core SDK."""
1114

12-
def test_exporter_default_suppression_is_false(self):
13-
"""Test that the default value for suppress_invoke_agent_input is False in exporter."""
14-
exporter = _Agent365Exporter(token_resolver=lambda x, y: "test")
15+
def test_processor_default_suppression_is_false(self):
16+
"""Test that the default value for suppress_invoke_agent_input is False in processor."""
17+
mock_exporter = Mock()
18+
processor = _EnrichingBatchSpanProcessor(mock_exporter)
1519

1620
self.assertFalse(
17-
exporter._suppress_invoke_agent_input,
21+
processor._suppress_invoke_agent_input,
1822
"Default value for suppress_invoke_agent_input should be False",
1923
)
24+
processor.shutdown()
2025

21-
def test_exporter_can_enable_suppression(self):
22-
"""Test that suppression can be enabled via exporter constructor."""
23-
exporter = _Agent365Exporter(
24-
token_resolver=lambda x, y: "test", suppress_invoke_agent_input=True
25-
)
26+
def test_processor_can_enable_suppression(self):
27+
"""Test that suppression can be enabled via processor constructor."""
28+
mock_exporter = Mock()
29+
processor = _EnrichingBatchSpanProcessor(mock_exporter, suppress_invoke_agent_input=True)
2630

2731
self.assertTrue(
28-
exporter._suppress_invoke_agent_input,
32+
processor._suppress_invoke_agent_input,
2933
"suppress_invoke_agent_input should be True when explicitly set",
3034
)
35+
processor.shutdown()
3136

3237

3338
def run_tests():
3439
"""Run all prompt suppression configuration tests."""
35-
print("🧪 Running prompt suppression configuration tests...")
40+
print("Running prompt suppression configuration tests...")
3641
print("=" * 80)
3742

3843
loader = unittest.TestLoader()
@@ -42,16 +47,16 @@ def run_tests():
4247
result = runner.run(suite)
4348

4449
print("\n" + "=" * 80)
45-
print("🏁 Test Summary:")
50+
print("Test Summary:")
4651
print(f"Tests run: {result.testsRun}")
4752
print(f"Failures: {len(result.failures)}")
4853
print(f"Errors: {len(result.errors)}")
4954

5055
if result.wasSuccessful():
51-
print("🎉 All tests passed!")
56+
print("All tests passed!")
5257
return True
5358
else:
54-
print("🔧 Some tests failed. Check output above.")
59+
print("Some tests failed. Check output above.")
5560
return False
5661

5762

0 commit comments

Comments
 (0)