fixed tests so nosetests/travis works better?

...to add setup and teardown to chdir into and out of directories  ... 
this common code should eventually be moved elsewhere