Test that the config replaces defaults with values from the environment. Args: monkeypatch: The pytest monkeypatch object. config_kwargs: The config kwargs. env_vars: The environment variables. set_persistent_vars: The values passed to config._set_persistent vari
(
monkeypatch,
config_kwargs,
env_vars,
set_persistent_vars,
exp_config_values,
)
| 350 | ], |
| 351 | ) |
| 352 | def test_replace_defaults( |
| 353 | monkeypatch, |
| 354 | config_kwargs, |
| 355 | env_vars, |
| 356 | set_persistent_vars, |
| 357 | exp_config_values, |
| 358 | ): |
| 359 | """Test that the config replaces defaults with values from the environment. |
| 360 | |
| 361 | Args: |
| 362 | monkeypatch: The pytest monkeypatch object. |
| 363 | config_kwargs: The config kwargs. |
| 364 | env_vars: The environment variables. |
| 365 | set_persistent_vars: The values passed to config._set_persistent variables. |
| 366 | exp_config_values: The expected config values. |
| 367 | """ |
| 368 | mock_os_env = os.environ.copy() |
| 369 | monkeypatch.setattr(reflex_base.config.os, "environ", mock_os_env) # pyright: ignore[reportPrivateImportUsage] |
| 370 | mock_os_env.update({k: str(v) for k, v in env_vars.items()}) |
| 371 | c = rx.Config(app_name="a", **config_kwargs) |
| 372 | c._set_persistent(**set_persistent_vars) |
| 373 | for key, value in exp_config_values.items(): |
| 374 | assert getattr(c, key) == value |
| 375 | |
| 376 | |
| 377 | def reflex_dir_constant() -> Path: |
nothing calls this directly
no test coverage detected