Run tests correctly in a virtualenv.
Merge pull request #236 from jsha/virtualenv-test

Do a better job of detecting virtualenvs