Skip to content

Commit 489a999

Browse files
mikolalysenkoclaude
andcommitted
fix: remove pypi force test (patch has no files with non-empty beforeHash)
The pydantic-ai@0.0.36 patch treats all files as new (empty beforeHash), so hash mismatch cannot occur. The --force feature is covered by the npm e2e test and 2 unit tests in apply.rs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d9c1df0 commit 489a999

File tree

1 file changed

+0
-71
lines changed

1 file changed

+0
-71
lines changed

crates/socket-patch-cli/tests/e2e_pypi.rs

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -571,77 +571,6 @@ fn test_pypi_save_only() {
571571
);
572572
}
573573

574-
/// `apply --force` should apply patches even when file hashes don't match.
575-
#[test]
576-
#[ignore]
577-
fn test_pypi_apply_force() {
578-
if !has_python3() {
579-
eprintln!("SKIP: python3 not found on PATH");
580-
return;
581-
}
582-
583-
let dir = tempfile::tempdir().unwrap();
584-
let cwd = dir.path();
585-
586-
setup_venv(cwd);
587-
588-
let site_packages = find_site_packages(cwd);
589-
590-
// Save the patch without applying.
591-
assert_run_ok(cwd, &["get", PYPI_UUID, "--save-only"], "get --save-only");
592-
593-
let manifest_path = cwd.join(".socket/manifest.json");
594-
let (_, files_value) = read_patch_files(&manifest_path);
595-
let files = files_value.as_object().unwrap();
596-
597-
// Find a file with a non-empty beforeHash (i.e., an existing file, not a new one).
598-
let (target_rel, target_before_hash) = files
599-
.iter()
600-
.filter_map(|(rel_path, info)| {
601-
let bh = info["beforeHash"].as_str().unwrap_or("");
602-
if !bh.is_empty() {
603-
Some((rel_path.clone(), bh.to_string()))
604-
} else {
605-
None
606-
}
607-
})
608-
.next()
609-
.expect("patch should have at least one file with a non-empty beforeHash");
610-
611-
let target_path = site_packages.join(&target_rel);
612-
assert_eq!(
613-
git_sha256_file(&target_path),
614-
target_before_hash,
615-
"{target_rel} should match beforeHash before corruption"
616-
);
617-
618-
// Corrupt the file to create a hash mismatch.
619-
std::fs::write(&target_path, b"# corrupted content\n").unwrap();
620-
assert_ne!(
621-
git_sha256_file(&target_path),
622-
target_before_hash,
623-
"{target_rel} should have a different hash after corruption"
624-
);
625-
626-
// Normal apply should fail due to hash mismatch.
627-
let (code, _stdout, _stderr) = run(cwd, &["apply"]);
628-
assert_ne!(code, 0, "apply without --force should fail on hash mismatch");
629-
630-
// Apply with --force should succeed.
631-
assert_run_ok(cwd, &["apply", "--force"], "apply --force");
632-
633-
// Verify all files match afterHash.
634-
for (rel_path, info) in files {
635-
let after_hash = info["afterHash"].as_str().expect("afterHash");
636-
let full_path = site_packages.join(rel_path);
637-
assert_eq!(
638-
git_sha256_file(&full_path),
639-
after_hash,
640-
"{rel_path} should match afterHash after apply --force"
641-
);
642-
}
643-
}
644-
645574
/// UUID shortcut: `socket-patch <UUID>` should behave like `socket-patch get <UUID>`.
646575
#[test]
647576
#[ignore]

0 commit comments

Comments
 (0)