I'm using a config file to get the info for my database.  It always gets the hostname and then figures out what database options to use from this config file.  I want to be able to tell if I'm inside a unittest here and use the in memory sqlite database instead.  Is there a way to tell at that point whether I'm inside a unittest, or will I have to find a different way?
This is kind of brute force but it works. Have an environmental variable UNIT_TEST that your code checks, and set it inside your unit test driver.
Is there a way to tell whether a function is getting executed in a unittest?