From 408c8e806fbb37597aebb403b7b90b4bd8623495 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Fri, 1 Mar 2024 16:08:54 -0500 Subject: [PATCH] utils/pypi: ignore test resources when counting matches Signed-off-by: Michael Cho --- Library/Homebrew/utils/pypi.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/utils/pypi.rb b/Library/Homebrew/utils/pypi.rb index 3899bc68bd..f308bc3992 100644 --- a/Library/Homebrew/utils/pypi.rb +++ b/Library/Homebrew/utils/pypi.rb @@ -358,7 +358,7 @@ module PyPI ohai "Updating resource blocks" unless silent Utils::Inreplace.inreplace formula.path do |s| - if s.inreplace_string.scan(inreplace_regex).length > 1 + if T.must(s.inreplace_string.split(/^ test do\b/, 2).first).scan(inreplace_regex).length > 1 odie "Unable to update resource blocks for \"#{formula.name}\" automatically. Please update them manually." end s.sub! inreplace_regex, new_resource_blocks