MCPcopy
hub / github.com/reflex-dev/reflex / test_replace_defaults

Function test_replace_defaults

tests/units/test_config.py:352–374  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

350 ],
351)
352def 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
377def reflex_dir_constant() -> Path:

Callers

nothing calls this directly

Calls 4

_set_persistentMethod · 0.95
copyMethod · 0.80
itemsMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected