title: How to print to console in pytest?
body: <p>I'm trying to use TDD (test-driven development) with <code>pytest</code>.
  <code>pytest</code> will not <code>print</code> to the console when I use <code>print</code>.</p>
  
  <p>I am using <code>pytest my_tests.py</code> to run it.</p>
  
  <p>The <code>documentation</code> seems to say that it should work by default: <a href="http://pytest.org/latest/capture.html" rel="noreferrer">http://pytest.org/latest/capture.html</a></p>
  
  <p>But:</p>
  
  <pre><code>import myapplication as tum
  
  class TestBlogger:
  
      @classmethod
      def setup_class(self):
          self.user = "alice"
          self.b = tum.Blogger(self.user)
          print "This should be printed, but it won't be!"
  
      def test_inherit(self):
          assert issubclass(tum.Blogger, tum.Site)
          links = self.b.get_links(posts)
          print len(links)   # This won't print either.
  </code></pre>
  
  <p>Nothing gets printed to my standard output console (just the normal progress and how many many tests passed/failed).</p>
  
  <p>And the script that I'm testing contains print:</p>
  
  <pre><code>class Blogger(Site):
      get_links(self, posts):
          print len(posts)   # It won't get printed in the test.
  </code></pre>
  
  <p>In <code>unittest</code> module, everything gets printed by default, which is exactly what I need. However, I wish to use <code>pytest</code> for other reasons.</p>
  
  <p><strong>Does anyone know how to make the print statements get shown?</strong></p>