title: Python, why is capsys not defined?
body: <p>I feel like I'm missing something completely obvious, but everywhere I see capsys mentioned it's described as built-in and all example code I see doesn't import anything to use it. Searching around I have a hard time even finding documentation on it, just people talking about it in threads.</p>
  <p>Despite this, if I try to use capsys I get a &quot;NameError: name 'capsys' is not defined&quot; error. What am I missing? If it built-in shouldn't it just...work?</p>
  <p>Python 3.9.4</p>
  <p>Edit 1: Including the test code in question</p>
  <pre><code>def test_print():
    print(&quot;test string&quot;)
    captured = capsys.readouterr()
    assert captured.out == &quot;test string\n&quot;
  </code></pre>