python run test with app installed from pip
For some of the python apps, if I install them manually, I can run python setup.py test
inside the app folder to carry out test scripts. But if I install them through pip, there's only an .egg file in dist-packages, so how should I run their test?
I did the following in a virtualenv and was able to run the tests.
$ pip install pyelasticsearch
$ pip install nose virtualenv scripttest mock
$ cdsitepackages #virtualenvwrapper shortcut to go to the site-packages directory
$ cd pyelasticsearch/tests
$ nosetests
Depending on where your site-packages directory is located you'll probably replace cdsitepackages with something else. As @thaven mentioned, there are two directories created - one that pyelasticsearch-0.5-py2.7.egg-info/ and one that is pyelasticsearch. If the pyelasticsearch package wasn't actually there, you wouldn't be able to import anything.
链接地址: http://www.djcxy.com/p/12914.html