[TIP] Run-time configuration of unittest cases

John Wong gokoproject at gmail.com
Wed Apr 23 13:44:38 PDT 2014


On Wed, Apr 23, 2014 at 4:32 PM, Mateusz Łoskot <mateusz at loskot.net> wrote:

>
> I'd like to sample for ideas about how to pass a set of parameters to
> unittest.TestCase objects in order to configure them at run-time
> with test data location, connection details to test databases, etc.


What kind of parameters? Are you expecting something like
test1 --> read data from /location/folder1
test2 --> read data from /newlocation/somedub/folder2

I normally go with configuration files. I like to have locality; the easier
I can inspect and edit values, the better. Also, I'd like to keep them in
version control. If I already have a shell script that takes a set of
parameters into os.env then I will expect that to be in version control. So
let's keep them in file and no EXPORT.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20140423/8c9843f5/attachment.htm>


More information about the testing-in-python mailing list