How can I test my python module without installing it

I'm in the process of redesigning/refactoring my Python quantum chemistry package (pyquante). One of the things I don't like about the existing release is that I have to install the package to run the test suite. That is, the test suite has statements like from PyQuante import SCF, and, of course, this PyQuante could refer to the installed version or a local version.

I know about virtualenv, and realize this is an option for me. But I was wondering whether anything else might be appropriate. In the past I've hacked sys.path for things like this, and have been told by better Python programmers that I shouldn't ever to this.

Does anyone have any suggestions for how I can do this? The point is that I want to test the current version of the code without installing it.

Thanks in advance for anyone who can see through my babbling and offer suggestions!

Answers


Create a proper package for your stuff and use

python setup.py develop

to make it a proper dev-package.

See:


I would honestly insist on using virtualenv, its designed for this exact reason in mind. very small overhead, and if you ever mess up just delete directory. I am sure as you grow, things won't be as simple as they are now for your current situation. Take it as an opportunity to learn.


Altering sys.path much in production environment may be unwise. Altering it for testing is usually OK.

If you don't want to tinker with the variable from sys, use an environment variable named PYTHONPATH, it's a clean and documented way.


Need Your Help

Is there a Null OutputStream in Java?

java outputstream

I need to specify an OutputStream for an API I'm using, but I don't actually have a need for the output. Does Java have an OutputStream equivalent to > /dev/null?

export Data in localStorage for later re-import

javascript import export local-storage

I want to export a few items from my localStorage to save it externally but in a format so that I can import it again later.