Skip to content

Commit de07be5

Browse files
dfmGoogle-ML-Automation
authored andcommitted
Fix pgle test handling of directory removal.
This is required after jax-ml#22899. PiperOrigin-RevId: 696555876
1 parent 3380a21 commit de07be5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/pgle_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import logging
1919
import math
2020
import os
21+
import shutil
2122
import tempfile
2223

2324
from absl.testing import absltest
@@ -286,7 +287,11 @@ def f(x):
286287
# Removing non-pgle profiled module from cache to check that later pgle
287288
# profiled version will be used.
288289
for non_pgle_file in non_pgle_profiled_files:
289-
os.remove(os.path.join(cache_dir, non_pgle_file))
290+
path = os.path.join(cache_dir, non_pgle_file)
291+
if os.path.isfile(path):
292+
os.remove(path)
293+
elif os.path.isdir(path):
294+
shutil.rmtree(path)
290295

291296
api.clear_caches()
292297
pjit._pgle_profiler_dict.clear()

0 commit comments

Comments
 (0)