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?
Ensure you can run pip from the command lineRun python get-pip.py . 2 This will install or upgrade pip. Additionally, it will install setuptools and wheel if they're not installed already. Be cautious if you're using a Python install that's managed by your operating system or another package manager.
PIP is a package manager for Python packages, or modules if you like. Note: If you have Python version 3.4 or later, PIP is included by default.
To check if PIP is already installed on Windows, we should open the command line again, type pip , and press Enter . If PIP is installed, we will receive a long notification explaining the program usage, all the available commands and options.
Use of a Python script to run pip to install a package is not supported by the Python Packaging Authority (PyPA) for the following reason: Pip is not thread-safe, and is intended to be run as a single process. When run as a thread from within a Python script, pip may affect non-pip code with unexpected results.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With