Search code examples
pythonpyramidnosetests

pass test config (test.ini) through nosetests to pyramid


I have seen this, which suggests parsing the config information directly:

passing **settings info to unittest from nose

...but that still requires me to hard-code 'test.ini'. How can I pass the name of the config file through nosetests to my application?


Solution

  • Pylons did this in the past by registering a special nose plugin that added the --with-pylons=test.ini option to nose. I might recommend just setting an environment variable with the filename and dealing with it that way.

    export TEST_INI="test.ini"
    env/bin/nosetests
    
    import os
    
    ini_file = os.environ['TEST_INI']