Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix failing tests #128

Merged
merged 5 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dataconf = 'dataconf.cli:run'

[tool.poetry.dependencies]
python = "^3.8"
pyhocon = "0.3.60"
pyhocon = "0.3.59"
python-dateutil = "^2.8.2"
PyYAML = "^6.0.1"
pyparsing = "2.4.7"
Expand Down
19 changes: 12 additions & 7 deletions tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def test_url(self) -> None:
class A:
url: str

os.environ["p_url"] = "https://github.com/zifeo/dataconf"
assert dataconf.env("p", A) == A(url="https://github.com/zifeo/dataconf")
os.environ.pop("p_url")
os.environ["P_URL"] = "https://github.com/zifeo/dataconf"
assert dataconf.env("P", A) == A(url="https://github.com/zifeo/dataconf")
zifeo marked this conversation as resolved.
Show resolved Hide resolved
os.environ.pop("P_URL")

def test_env_var_cast_35(self) -> None:
@dataclass
Expand All @@ -164,16 +164,21 @@ class Example:
hello=None, world="monde", float_num=1.3, int_num=2, bool_var=True
)

def test_dump_fail_54(self):
@pytest.fixture
def named_temporary_file(self):
tfile = tempfile.NamedTemporaryFile(delete=False)
yield tfile
tfile.close()

def test_dump_fail_54(self, named_temporary_file):
@dataclass
class Config:
experiment_name: str

original = Config("test_dump")

with tempfile.NamedTemporaryFile() as f:
dataconf.dump(f.name, original, out="yaml")
validate = dataconf.file(f.name, Config)
dataconf.dump(named_temporary_file.name, original, out="yaml")
validate = dataconf.file(named_temporary_file.name, Config)

assert original == validate

Expand Down
Loading