Fixes what I believe is a small bug in tests.

Also introduces a variable to remove repeated use of directory name.