Skip to content

Commit dfd5573

Browse files
authored
PYTHON-5002 Include test/ dir in synchro gaurd (#2379)
1 parent 8a8cb6f commit dfd5573

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tools/synchro.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,13 +417,18 @@ def unasync_directory(files: list[str], src: str, dest: str, replacements: dict[
417417
def main() -> None:
418418
modified_files = [f"./{f}" for f in sys.argv[1:]]
419419
errored = False
420-
for fname in async_files + gridfs_files:
420+
for fname in async_files + gridfs_files + test_files:
421421
# If the async file was modified, we don't need to check if the sync file was also modified.
422422
if str(fname) in modified_files:
423423
continue
424424
sync_name = str(fname).replace("asynchronous", "synchronous")
425-
if sync_name in modified_files and "OVERRIDE_SYNCHRO_CHECK" not in os.environ:
426-
print(f"Refusing to overwrite {sync_name}")
425+
test_sync_name = str(fname).replace("/asynchronous", "")
426+
if (
427+
sync_name in modified_files
428+
or test_sync_name in modified_files
429+
and "OVERRIDE_SYNCHRO_CHECK" not in os.environ
430+
):
431+
print(f"Refusing to overwrite {test_sync_name}")
427432
errored = True
428433
if errored:
429434
raise ValueError("Aborting synchro due to errors")

0 commit comments

Comments
 (0)