Update preparetest.py

Add a function to check whether the target directory is empty, and refuse to install if it's not.