title: Why is mocking out zeep.Client not working?
body: <p>I'm writing unit tests for a piece of code that uses zeep to access a SOAP API so I want to mock out zeep. In my actual code, it looks something like this:</p>
  
  <pre><code>from zeep import Client
  
  def do_something():
      client = Client("...")
  </code></pre>
  
  <p>In my test, I'm doing this:</p>
  
  <pre><code>from unittest import mock
  
  @mock.patch('zeep.Client')
  def test_do_somethi(self, MockedClient):
      do_something()
  </code></pre>
  
  <p>The <code>Client</code> that the actual function is obtaining, is the actual zeep client and not my mock. I also tried:</p>
  
  <pre><code>@mock.patch('zeep.client.Client')
  </code></pre>
  
  <p>and the result was the same.</p>
  
  <p>I also tried:</p>
  
  <pre><code>def test_do_something(self):
    with mock.patch('zeep.client.Client') as MockedClient:
       do_something()
  </code></pre>
  
  <p>with no difference.</p>
  
  <p>Any ideas why this isn't working?</p>