todddeluca/python-vagrant — pull request #22 by gertjanol (2014-03-24 13:33:25+00:00)
Title: don't die if vagrant-exe is missing until it is used

We've written a simple vagrant driver for libcloud. This driver uses python-vagrant for all the actual vagrant stuff. The unittests for our driver and the surrounding libraries do not require actually booting any instances.

However, our unittests will fail if vagrant is not installed, because ```vagrant/__init__.py``` dies on import if it can't find the vagrant binary. While I understand why you did this (why use this module if you don't have vagrant, right?) it makes it quite difficult to write a lean library that uses python-vagrant.

This PR replaces the assertion on import with a warning, and will trigger an exception at runtime.

Another approach might be to move the ```which```-function to a separate utils-module. That would make it possible to patch ```utils.which``` to return True in our tests, before ```vagrant``` gets imported. I think removing the assertion from global namespace is a better solution though.