Skip to content

Commit

Permalink
Can't read Pydantic Settings from stdin
Browse files Browse the repository at this point in the history
Fixes #296
Addressed CR feedback
  • Loading branch information
WarpedPixel authored and WarpedPixel committed Jul 1, 2024
1 parent a8c404c commit 33f5646
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,22 @@ def _read_env_files(self) -> Dict[str, str]:
assert source._read_env_files() == {'foo': 'stdin_foo', 'bar': 'stdin_bar'}


# test that calling read_env_file issues a DeprecationWarning
# TODO: remove this test once read_env_file is removed
def test_read_env_file_deprecation(tmp_path):
from pydantic_settings.sources import read_env_file

base_env = tmp_path / '.env'
base_env.write_text(test_default_env_file)

with pytest.deprecated_call():
assert read_env_file(base_env) == {
'debug_mode': 'true',
'host': 'localhost',
'port': '8000',
}


@pytest.mark.skipif(yaml, reason='PyYAML is installed')
def test_yaml_not_installed(tmp_path):
p = tmp_path / '.env'
Expand Down

0 comments on commit 33f5646

Please sign in to comment.