Test that kwargs override environment variables
(mock_env, valid_uuid)
| 52 | |
| 53 | |
| 54 | def test_config_override_env(mock_env, valid_uuid): |
| 55 | """Test that kwargs override environment variables""" |
| 56 | config = Config() |
| 57 | |
| 58 | # Store the original value from environment |
| 59 | original_max_queue_size = config.max_queue_size |
| 60 | |
| 61 | config.configure( |
| 62 | api_key=valid_uuid, |
| 63 | endpoint="https://override.agentops.ai", |
| 64 | app_url="https://override-app.agentops.ai", |
| 65 | max_wait_time=2000, |
| 66 | default_tags=["new-tag"], |
| 67 | instrument_llm_calls=True, |
| 68 | max_queue_size=original_max_queue_size, # Explicitly pass the original value |
| 69 | ) |
| 70 | |
| 71 | assert config.api_key == valid_uuid |
| 72 | assert config.endpoint == "https://override.agentops.ai" |
| 73 | assert config.app_url == "https://override-app.agentops.ai" |
| 74 | assert config.max_wait_time == 2000 |
| 75 | assert config.default_tags == {"new-tag"} |
| 76 | assert config.instrument_llm_calls is True |
| 77 | # Other values should remain from env |
| 78 | assert config.max_queue_size == 256 # Use the value from mock_env |
| 79 | |
| 80 | |
| 81 | def test_invalid_api_key(): |