astropy/astropy — pull request #505 by astrofrog (2012-11-27 11:15:39+00:00)
Title: Run tests from temporary directory

This is an alternative fix to #403, which runs the tests in a temporary directory. I originally had

```
try:
tmp_dir = tempfile.mkdtemp()
except OSError: # if permissions don't allow above, create local dir
tmp_dir = 'tmp_testing'
if os.path.exists(tmp_dir):
shutil.rmtree(tmp_dir)
os.mkdir(tmp_dir)
```

for the creation of the temporary directory, in case permissions don't allow users to use ``mkdtemp`` - however, what I don't like about the above is that if for some reason a user has a directory called ``tmp_testing``, it would get removed without warning. Maybe instead I should generate a random directory name to avoid any potential clashes? Any thoughts?