Test installed Python package

Viewed 1393

To test my Python package I run in the source directory: python setup.py test

If I understand correctly this tests the code in the source directory, not the installed package.

How can I test if the installation was successful. Is it possible (or even common practice) to run the test suite on the installed packages?

2 Answers

Thanks to Goyo I found a solution I am happy with. I install the my package (let's call it my-package) including the tests through setuptools and run the following in the installation directory (e.g., python-env/lib/python3.x/site-packages):

nosetests my-package

To test if a package was successfully installed on your machine, open python and type

import my_package

If you get no error, that means the package was successfully installed on your machine and you are good to go

Related