Mark,<br><br>Thanks for the explanation and pointing me to the link. It makes sense to me now. &quot;py.test -s&quot; works for me in this case. Thanks again<br><br>-hans<br><br><div class="gmail_quote">2011/12/7 Mark Sienkiewicz <span dir="ltr">&lt;<a href="mailto:sienkiew@stsci.edu">sienkiew@stsci.edu</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    On 12/06/11 20:55, Hans Sebastian wrote:
    <blockquote type="cite">
      
      Hi all,<br>
      <br>
      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.</blockquote>
    <br>
    <br>
    </div><blockquote type="cite"><font face="courier new,monospace">
        <br><div class="im">
            def fileno(self):<br>
        &gt;       raise ValueError(&quot;redirected Stdin is pseudofile, has
        no fileno()&quot;)<br>
        E       ValueError: redirected Stdin is pseudofile, has no
        fileno()<br>
      </div></font></blockquote>
    <br>
    <br>
    py.test is replacing sys.stdin and sys.stdout with &quot;file-like
    objects&quot;, but those objects do not have any real file descriptors. 
    This fileno() can&#39;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.<br>
    <br>
    Your program is trying to do something directly with the file
    descriptor for stdin, so you can&#39;t have your test system preventing
    access.  You might try &quot;pytest -s&quot; to make it not mess with
    stdin/stdout.  There is a brief discussion of capturing stdin/stdout
    at <a href="http://pytest.org/latest/capture.html" target="_blank">http://pytest.org/latest/capture.html</a> .<br>
    <br>
    Mark S.<br>
    <br>
  </div>

<br>_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
<br></blockquote></div><br>