Apply lightweight_test changes before deleting file, so preserve changes in case deletion later reverted.