0

I have a python script which takes a config file on command line and gives an output.

I am trying to see how I can use nosetests to run all these files.

I read through the nosetests info on google but i could not follow how to run them with the config file.

Any ideas on where I could get started?

2 Answers 2

3

Something like this should work:

import sys
import nose

def test_me():
    assert True

if __name__ == '__main__':
    module_name = sys.modules[__name__].__file__

    config_name = 'nose.cfg'

    result = nose.run(
        argv=[sys.argv[0],
              module_name,
              '--config=' + config_name]
        )

You can also pass your config instance, as described in the docs for nose.run() arguments here.

Sign up to request clarification or add additional context in comments.

Comments

0

I didnt have to do any of those. Just nosetests by themselves execute any test beginning with "test_....py" and make sure you use "--exe" if they are executable if not you can skip that option. The nosetests help page on wiki really helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.