PYTHON-5002 Include test/ dir in synchro gaurd (#2379)

This commit is contained in:
Jeffrey A. Clark 2025-06-11 15:54:32 -04:00 committed by GitHub
parent 8a8cb6f0af
commit dfd5573c19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -417,13 +417,18 @@ def unasync_directory(files: list[str], src: str, dest: str, replacements: dict[
def main() -> None:
modified_files = [f"./{f}" for f in sys.argv[1:]]
errored = False
for fname in async_files + gridfs_files:
for fname in async_files + gridfs_files + test_files:
# If the async file was modified, we don't need to check if the sync file was also modified.
if str(fname) in modified_files:
continue
sync_name = str(fname).replace("asynchronous", "synchronous")
if sync_name in modified_files and "OVERRIDE_SYNCHRO_CHECK" not in os.environ:
print(f"Refusing to overwrite {sync_name}")
test_sync_name = str(fname).replace("/asynchronous", "")
if (
sync_name in modified_files
or test_sync_name in modified_files
and "OVERRIDE_SYNCHRO_CHECK" not in os.environ
):
print(f"Refusing to overwrite {test_sync_name}")
errored = True
if errored:
raise ValueError("Aborting synchro due to errors")