[TIP] Run-time configuration of unittest cases

Mateusz Łoskot mateusz at loskot.net
Wed Apr 23 13:32:14 PDT 2014

On 23 April 2014 22:16, Andres Riancho <andres.riancho at gmail.com> wrote:
> Usually I just set the environment variables in the CI system, and in
> the python source code do:
> import os
> os.getenv('VARIABLE')
> That's dead-simple and works :)

That's actually a good idea.

I just have large number of test modules with 1-3 dozens of parameters,
so I'd prefer to have them in a config file.

On the other hand, config file or environment variables, both options
are similar. The setUpModule could simply read parameters and set
them as env variables accessible with os.getenv from TestCase.setUp.

Best regards,
Mateusz  Łoskot, http://mateusz.loskot.net

More information about the testing-in-python mailing list