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

Function test_env_file

tests/units/test_config.py:504–526  ·  view source on GitHub ↗

Test that the env_file method loads environment variables from a file. Args: tmp_path: The pytest tmp_path object. file_map: A mapping of file names to their contents. env_file: The path to the environment file to load. exp_env_vars: The expected environment vari

(
    tmp_path: Path,
    file_map: dict[str, str],
    env_file: str,
    exp_env_vars: dict[str, str],
)

Source from the content-addressed store, hash-verified

502 ],
503)
504def test_env_file(
505 tmp_path: Path,
506 file_map: dict[str, str],
507 env_file: str,
508 exp_env_vars: dict[str, str],
509) -> None:
510 """Test that the env_file method loads environment variables from a file.
511
512 Args:
513 tmp_path: The pytest tmp_path object.
514 file_map: A mapping of file names to their contents.
515 env_file: The path to the environment file to load.
516 exp_env_vars: The expected environment variables after loading the file.
517 """
518 for filename, content in file_map.items():
519 (tmp_path / filename).write_text(content)
520
521 _ = rx.Config(
522 app_name="test_env_file",
523 env_file=env_file.format(path=tmp_path, sep=os.pathsep),
524 )
525 for key, value in exp_env_vars.items():
526 assert os.environ.get(key) == value
527
528
529class TestDisablePlugins:

Callers

nothing calls this directly

Calls 2

itemsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected