cleanup for --tmpdir, add unit test

@wpoely86: This also contains a necessary sync with `develop` (because of a very minor conflict in `options.py` because https://github.com/hpcugent/easybuild-framework/pull/786 was merged in first.

The only commit you should really care about for reviewing this is `41adcbb`.