title: How to delete temporary test file?
body: <p>I want to create a python test using pytest. In the test, I will create a temporary JSON file and do some something to the json file. How do I delete this file when I complete this test?</p>
  <pre><code>def test_can_do_something():
      tmp_json = create_some_tmp_json_file()
      do_something(tmp_json)
      assert some_statement
  </code></pre>
  <p>Basically I want to guarantee the temperory JSON file is deleted no matter how this test ends. Even if some exception thrown by do_something(). RAII idiom is a good choice. But how do I implement in python?</p>