unittest & setup

Joe Riopel goon12 at gmail.com
Wed Nov 4 09:08:12 EST 2009


On Tue, Nov 3, 2009 at 11:02 PM, Jonathan Haddad <jon at jonhaddad.com> wrote:
> I've got a class, in the constructor it loads a CSV file from disc.  I'd
> like only 1 instance of the class to be instantiated.  However, when running
> multiple unit tests, multiple instances of the class are created.  What's
> the best way for me to avoid this?  It takes about a few seconds to load the
> CSV file.

This post that might be worth reading, as it relates to testing with
singletons.

http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/

As is this

http://misko.hevery.com/code-reviewers-guide/



More information about the Python-list mailing list