So I thought there were some inefficiencies in upload_image_file... And when I fixed them, all related test died. So never mind that. Don't touch the Path related things, something about the way they are imported makes them fragile.
E: Found what the problem was - we are testing Windows paths on Linux, so we have to use PureWindowsPath instead of WindowsPath in tests, which means no interaction with system, which means no Path.exists(). Means that my changes worked fine, but broke tests.
So I thought there were some inefficiencies in upload_image_file... And when I fixed them, all related test died. So never mind that. Don't touch the Path related things, something about the way they are imported makes them fragile.
E: Found what the problem was - we are testing Windows paths on Linux, so we have to use PureWindowsPath instead of WindowsPath in tests, which means no interaction with system, which means no Path.exists(). Means that my changes worked fine, but broke tests.