Home > python > TypeError: Need a valid target to patch. You supplied: ‘SomeClass’

TypeError: Need a valid target to patch. You supplied: ‘SomeClass’

Problem:

I needed to mock out a method in a class that I was clearly importing. But when I tried to patch it gave me the following error where “SomeClass” is the name of the class I was trying to mock out.

TypeError: Need a valid target to patch. You supplied: ‘SomeClass’

Solution:
A very clear explanation of what I was doing wrong was on SO

http://stackoverflow.com/questions/16060724/patch-why-wont-the-relative-patch-target-name-work

Advertisements
Categories: python Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: