title: How to load/remove namespaces in clojure during tests
body: <p>I'm working on a library that finds dependencies within the source tree during application startup and I'm trying to write an integration test to ensure it works. I've got fixture files in my test namespaces, and the test starts and succeeds just fine.</p>
  
  <p>To be sure that the tests don't affect future runs, I added an "after" handler (in midje) that uses <code>remove-ns</code> to remove the test fixture namespaces.</p>
  
  <p>On the next load, the tests fail because the namespaces are missing.</p>
  
  <p>It seems as if <code>remove-ns</code> not only removes the namespace, it makes it impossible to use <code>require</code> to load it into the same running VM afterwards. I note that there is a "use with caution" note on <code>remove-ns</code> with no explanation. </p>
  
  <p>I've verified that manually running <code>require</code> does not, indeed, seem to be able to re-load a namespace that has been removed:</p>
  
  <pre><code> user=&gt;(test.util.fixtures.A/f)
   {:item 1}
   user=&gt; (remove-ns 'test.util.fixtures.A)
   #&lt;Namespace test.util.fixtures.A&gt;
   user=&gt; (test.util.fixtures.A/f)
   ClassNotFoundException test.util.fixtures.A  
   user=&gt; (require 'test.util.fixtures.A)
   nil
   user=&gt; (test.util.fixtures.A/f)
   ClassNotFoundException test.util.fixtures.A  
  </code></pre>
  
  <p>Anyone understand why this is happening?</p>