refactor(test): simplify test patches per code review feedback
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -21,15 +21,9 @@ class TestReleaseNameProperty:
|
|||||||
release_file = tmp_path / "release_names.json"
|
release_file = tmp_path / "release_names.json"
|
||||||
release_file.write_text(json.dumps(release_data))
|
release_file.write_text(json.dumps(release_data))
|
||||||
|
|
||||||
with (
|
|
||||||
patch("app.config.Settings.version", new_callable=lambda: property(lambda self: "0.5.3")),
|
|
||||||
patch("app.config.os.path.join", return_value=str(release_file)),
|
|
||||||
patch("app.config.os.path.exists", return_value=True),
|
|
||||||
):
|
|
||||||
from app.config import Settings
|
from app.config import Settings
|
||||||
|
|
||||||
s = Settings.__new__(Settings)
|
s = Settings.__new__(Settings)
|
||||||
# Directly call the property with mocked file path
|
|
||||||
with (
|
with (
|
||||||
patch.object(type(s), "version", new_callable=lambda: property(lambda self: "0.5.3")),
|
patch.object(type(s), "version", new_callable=lambda: property(lambda self: "0.5.3")),
|
||||||
patch("app.config.os.path.dirname"),
|
patch("app.config.os.path.dirname"),
|
||||||
|
|||||||
Reference in New Issue
Block a user