Nose test script with command line arguments

后端 未结 5 1427
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 06:54

I would like to be able to run a nose test script which accepts command line arguments. For example, something along the lines:

test.py

import nose, sys
         


        
5条回答
  •  甜味超标
    2021-02-04 07:23

    You could use another means of getting stuff into your code:

    import os
    
    print os.getenv('KEY_THAT_MIGHT_EXIST', default_value)
    

    Then just remember to set your environment before running nose.

提交回复
热议问题