यहाँ क्या मेरे लिए काम करता है:
$ virtualenv --no-site-packages env1
$ cd env1
$ source bin/activate # makes "env1" environment active,
# you will notice that the command prompt
# now has the environment name in it.
(env1)$ easy_install nose # install nose package into "env1"
मैं एक बहुत बुनियादी पैकेज slither
कि था, इसके setup.py
में, एक ही test_suite
विशेषता बना के रूप में आप ऊपर उल्लेख किया है। फिर मैंने पैकेज स्रोत को env1/src
के तहत रखा।
आप env1/src
अंदर देखा, तो आप देखना चाहते हैं:
slither/setup.py
slither/slither/__init__.py
slither/slither/impl.py # has some very silly code to be tested
slither/slither/tests.py # has test-cases
मैं परीक्षण test
subcommand का उपयोग कर चला सकते हैं:
(env1)$ pushd src/slither
(env1)$ python setup.py test
# ... output elided ...
test_ctor (slither.tests.SnakeTests) ... ok
test_division_by_zero (slither.tests.SnakeTests) ... ok
Ran 2 tests in 0.009s
OK
(env1)$ popd
या, मैं nosetests
के साथ एक ही परीक्षण चला सकते हैं:
(env1)$ pushd src
(env1)$ nosetests slither/
..
Ran 2 tests in 0.007s
OK
(env1)$ popd
यह भी ध्यान दें कि nosetests
सी निष्पादन योग्य के बारे में एक picky हो। यदि आप इसे पाइथन मॉड्यूल में परीक्षणों को खोजना चाहते हैं तो आप --exe
पास कर सकते हैं।
स्रोत
2009-05-14 20:59:22
संबंधित नोट पर, नाक एक अलग कंप्यूटर पर "बॉक्स से बाहर" ठीक काम करता है ... इसलिए सिस्टम के साथ कुछ गड़बड़ है समस्याएं हैं – Ryan