title: How can I copy an in-memory SQLite database to another in-memory SQLite database in Python?
body: <p>I'm writing a test suite for Django that runs tests in a tree-like fashion. For example, Testcase A might have 2 outcomes, and Testcase B might have 1, and Testcase C might have 3. The tree looks like this</p>
  
  <pre><code>      X
       /
  A-B-C-X
   \   \
    B   X
     \   X
      \ /
       C-X
        \
         X
  </code></pre>
  
  <p>For each path in the tree above, the database contents may be different. So at each fork, I'm thinking of creating an in-memory copy of the current state of the database, and then feeding that parameter into the next test.</p>
  
  <p>Anyone have an idea about how to essentially copy the in-memory database to another one, and then get a reference to pass that database around?</p>
  
  <p>Thanks!</p>