365
with patch.dict(os.environ, {"TEST_ENV": "option1,option1,option2"}):
366
env_func = env_set_with_choices("TEST_ENV", [], ["option1", "option2"])
367
assert env_func() == {"option1", "option2"}
368
+
369
+
370
+class TestVllmConfigureLogging:
371
+ """Test cases for VLLM_CONFIGURE_LOGGING environment variable."""
372
+
373
+ def test_configure_logging_defaults_to_true(self):
374
+ """Test that VLLM_CONFIGURE_LOGGING defaults to True when not set."""
375
+ # Ensure the env var is not set
376
+ with patch.dict(os.environ, {}, clear=False):
377
+ if "VLLM_CONFIGURE_LOGGING" in os.environ:
378
+ del os.environ["VLLM_CONFIGURE_LOGGING"]
379
+
380
+ # Clear cache if it exists
381
+ if hasattr(envs.__getattr__, "cache_clear"):
382
+ envs.__getattr__.cache_clear()
383
+
384
+ result = envs.VLLM_CONFIGURE_LOGGING
385
+ assert result is True
386
+ assert isinstance(result, bool)
387
+
388
+ def test_configure_logging_with_zero_string(self):
389
+ """Test that VLLM_CONFIGURE_LOGGING='0' evaluates to False."""
390
+ with patch.dict(os.environ, {"VLLM_CONFIGURE_LOGGING": "0"}):
391
+ # Clear cache if it exists
392
+ if hasattr(envs.__getattr__, "cache_clear"):
393
+ envs.__getattr__.cache_clear()
394
+
395
+ result = envs.VLLM_CONFIGURE_LOGGING
396
+ assert result is False
397
+ assert isinstance(result, bool)
398
+
399
+ def test_configure_logging_with_one_string(self):
400
+ """Test that VLLM_CONFIGURE_LOGGING='1' evaluates to True."""
401
+ with patch.dict(os.environ, {"VLLM_CONFIGURE_LOGGING": "1"}):
402
+ # Clear cache if it exists
403
+ if hasattr(envs.__getattr__, "cache_clear"):
404
+ envs.__getattr__.cache_clear()
405
+
406
+ result = envs.VLLM_CONFIGURE_LOGGING
407
+ assert result is True
408
+ assert isinstance(result, bool)
409
+
410
+ def test_configure_logging_with_invalid_value_raises_error(self):
411
+ """Test that invalid VLLM_CONFIGURE_LOGGING value raises ValueError."""
412
+ with patch.dict(os.environ, {"VLLM_CONFIGURE_LOGGING": "invalid"}):
413
+ # Clear cache if it exists
414
+ if hasattr(envs.__getattr__, "cache_clear"):
415
+ envs.__getattr__.cache_clear()
416
+
417
+ with pytest.raises(ValueError, match="invalid literal for int"):
418
+ _ = envs.VLLM_CONFIGURE_LOGGING