From 0e39d67a5941e33a781f2ec180dadcb79a40ae3e Mon Sep 17 00:00:00 2001 From: Pierre GIRAUD Date: Thu, 12 Dec 2024 16:10:45 +0100 Subject: [PATCH] Fix wrong variable name --- tests/test_hba.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/test_hba.py b/tests/test_hba.py index 77a7db9..35d9dc3 100644 --- a/tests/test_hba.py +++ b/tests/test_hba.py @@ -160,6 +160,8 @@ def test_hba_path(tmp_path): hba = HBA() assert hba.path is None + with pytest.raises(ValueError, match="No file-like object nor path provided"): + hba.save() p = tmp_path / "filename" hba = HBA([], p) @@ -199,24 +201,24 @@ def test_parse_file(mocker, tmp_path): mocker.patch("builtins.open", m) except Exception: mocker.patch("__builtin__.open", m) - pgpass = parse("filename") - pgpass.lines.append(HBAComment("# Something")) + hba = parse("filename") + hba.lines.append(HBAComment("# Something")) assert m.called - pgpass.save() + hba.save() handle = m() handle.write.assert_called_with("# Something\n") # Also works for other string types m.reset_mock() - pgpass = parse("filename") - pgpass.lines.append(HBAComment("# Something")) + hba = parse("filename") + hba.lines.append(HBAComment("# Something")) assert m.called # Also works with path m.reset_mock() - pgpass = parse(tmp_path / "filename") - pgpass.lines.append(HBAComment("# Something")) + hba = parse(tmp_path / "filename") + hba.lines.append(HBAComment("# Something")) assert m.called