title: How to patch (mocking) tests with Errbot?
body: <p>I'm trying to patch dependencies with my <a href="http://errbot.io" rel="nofollow noreferrer">errbot</a> tests. The problem I'm having is how errbot imports modules. It is not static and breaks my patch decorators as I add tests or they test in a different order.</p>
  
  <p>I have plugin called EDB (edb.py). Inside of edb.py I import pyedb with <code>import pyedb</code>. This is located in my <code>site-packages</code>.</p>
  
  <p>I have my test file test_edb.py and I try to patch my test methods like this</p>
  
  <pre><code>pytest_plugins = ["errbot.backends.test"]
  extra_plugin_dir = '.'
  
  from unittest.mock import patch  # noqa: E402
  
  @patch('yapsy_loaded_plugin_EDB_1.pyedb', autospec=True)
  def test_edb_testlist(pyedb_mock, testbot):
      testbot.push_message('!edb testlist')
  
      assert "Okay, let me get..." == testbot.pop_message()
      assert "I don't see any..." == testbot.pop_message()
  </code></pre>
  
  <p>Errbot adds this <code>yapsy_loaded_plugin_EDB_&lt;xx&gt;</code> path for module import but the xx depends on the order the test is run. This doesn't work, I need some static import path <code>mypath.pyedb</code>.</p>
  
  <p>I'm hoping there is a different way to approach this. Maybe I can change the how I import the module so it's not dependent on errbot imports? </p>
  
  <p>Here is a link to <a href="http://errbot.io/en/latest/user_guide/plugin_development/testing.html" rel="nofollow noreferrer">Errbot testing</a> for reference.</p>