sebastien/cuisine — pull request #80 by lost-theory (2012-06-05 01:53:37+00:00)
Title: make "file_*" tests less susceptible to unexpected output breakage

I had an incorrect hostname set on my machine, which caused the output of:

run('test -e "%s" && echo OK ; true' % (location))

to be:

'sudo: unable to resolve host experiment-2.local\r\nOK'

So even though the file existed, it failed because of the unexpected output. I noticed a few other functions (e.g. ``dir_exists``) had a workaround for this, so I made all of the ``file_*`` checks match that logic.

Note: I think a better way to do this kind of check is using ``with settings(warn_only=True)`` and then check the exit code of the command. That way you aren't relying on the text output, and you don't need the extra logic like ``cmd && echo OK ; true``