Writing simpletests for imagecache_create_url and file_create_url today, I had to change a few of Drupal's persistent variables, namely clean_url and file_downloads. I was kind of frustrated by the need to save the old values, set the values I needed for the test case, run the test, then restore the old variables. The process itself is a little dangerous in the case where you hit runtime fatal errors and the variables never get restored.