From 8c55e4880347d5df7c62347d9b2819f3be44613c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 19:39:44 +0000 Subject: [PATCH] Improve test determinism for git_sha default test Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> --- tests/test_config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index fd1defa1..a16a22bf 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -134,8 +134,12 @@ class TestBuildMetadataConfiguration: ) assert config.git_sha == "abc1234" - def test_git_sha_default(self): + def test_git_sha_default(self, monkeypatch, tmp_path): """Test that git_sha defaults to 'unknown' when not set.""" + # Mock the file system to ensure no GIT_SHA file exists + import app.config + monkeypatch.setattr(app.config.os.path, 'dirname', lambda x: str(tmp_path)) + config = Settings( database_url="sqlite:///test.db", redis_url="redis://localhost:6379", @@ -148,8 +152,7 @@ class TestBuildMetadataConfiguration: auth_enabled=False ) # When no file or env var exists, should return "unknown" - # (Note: In actual tests, VERSION file exists, so version won't be default) - assert config.git_sha in ["unknown", "6812d0d"] # May have been generated + assert config.git_sha == "unknown" def test_runtime_info_property(self): """Test that runtime_info returns build information."""