From 14abd64b00bbd5d0f2d6207d21ce50e2c36141c8 Mon Sep 17 00:00:00 2001 From: kshitij Date: Thu, 30 Jul 2026 20:54:14 +0500 Subject: [PATCH] test: drop change-detector test, keep behavioral test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_generated_script_contains_umask_else_branch asserted on shell script text ('else', 'umask', '(0666 & ~0', 'chmod') rather than behavior — a change-detector test per AGENTS.md. The behavioral test (test_new_file_gets_umask_default_permissions) already covers the actual behavior end-to-end via real subprocess. --- tests/tools/test_file_operations.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tests/tools/test_file_operations.py b/tests/tools/test_file_operations.py index 472fd8cb8f3..bc3b6c4542f 100644 --- a/tests/tools/test_file_operations.py +++ b/tests/tools/test_file_operations.py @@ -561,28 +561,6 @@ class _DeletedTestGitBaselineCheck: class TestAtomicWriteNewFilePermissions: """_atomic_write should apply umask-default perms to new files (not 0600).""" - def test_generated_script_contains_umask_else_branch(self): - """The shell script should contain the umask-computed chmod for new files.""" - mock = MagicMock() - mock.cwd = "/tmp" - ops = ShellFileOperations(mock) - # _atomic_write is private; exercise it via write_file which delegates - result = ops.write_file("/tmp/nonexistent/new_file.txt", "hello") - # The mock always returns success, but we captured the generated script - script = mock.execute.call_args[0][0] - assert "else" in script, ( - "Expected 'else' branch for new-file mode, got:\n" + script - ) - assert "umask" in script, ( - "Expected 'umask' call in else branch, got:\n" + script - ) - assert "(0666 & ~0" in script, ( - "Expected umask-computed mode in else branch, got:\n" + script - ) - assert "chmod" in script, ( - "Expected chmod of computed mode in else branch, got:\n" + script - ) - def test_new_file_gets_umask_default_permissions(self, tmp_path): """Newly created file should get umask-computed perms, not mktemp's 0600.