title: How do I mock an open used in a with statement (using the Mock framework in Python)?
body: <p>How do I test the following code with <a href="https://docs.python.org/3/library/unittest.mock.html" rel="noreferrer"><code>unittest.mock</code></a>:</p>
  <pre><code>def testme(filepath):
      with open(filepath) as f:
          return f.read()
  </code></pre>