[TIP] problem running fabric commands with py.test

Hans Sebastian hnsbstn at gmail.com
Thu Dec 8 09:50:16 PST 2011


Mark,

Thanks for the explanation and pointing me to the link. It makes sense to
me now. "py.test -s" works for me in this case. Thanks again

-hans

2011/12/7 Mark Sienkiewicz <sienkiew at stsci.edu>

>  On 12/06/11 20:55, Hans Sebastian wrote:
>
> Hi all,
>
> I am trying to execute a remote command using fabric in my test run by
> py.test. Fabric is a library for using SSH and I myself is quite new to it
> and just want to start using it. The problem is when i run it with py.test
> I am getting an error, but not when invoking with python.
>
>
>
>
>     def fileno(self):
> >       raise ValueError("redirected Stdin is pseudofile, has no fileno()")
> E       ValueError: redirected Stdin is pseudofile, has no fileno()
>
>
>
> py.test is replacing sys.stdin and sys.stdout with "file-like objects",
> but those objects do not have any real file descriptors.  This fileno()
> can't possibly return a correct value (there is no file descriptor), so it
> raises an exception.  The logic is that automated tests are not
> interactive, so we expect them to not read from stdin.
>
> Your program is trying to do something directly with the file descriptor
> for stdin, so you can't have your test system preventing access.  You might
> try "pytest -s" to make it not mess with stdin/stdout.  There is a brief
> discussion of capturing stdin/stdout at
> http://pytest.org/latest/capture.html .
>
> Mark S.
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20111208/961081b5/attachment.htm>


More information about the testing-in-python mailing list