Github action - Tests cleanup fails on `rm -rf`: Directory not empty
Description
I'm using cibuildwheel's Github action to build manylinux2014_x86_64 wheels for my Pytorch C extension. I added the line
CIBW_TEST_COMMAND: pytest {project}/tests
in my workflow file to perform tests after the build has succeeded. The tests pass with no problem, but the job sometimes fails at the end on the command
rm -rf /tmp/tmp.mXcluW4Jpi
with the message
rm: cannot remove ‘/tmp/tmp.mXcluW4Jpi/venv/lib/python3.12/site-packages/sympy/core’: Directory not empty
I'm not sure why this is happening.
Build log
https://github.com/hchau630/torch-bessel/actions/runs/12799307813/job/35685108808
CI config
https://github.com/hchau630/torch-bessel/tree/main/.github/workflows
I have found that this issue can sometimes be fixed just by re-running the job, though not guaranteed.