isolate tests by using temporary directories and properly undoing setwd() calls