[Pythonmac-SIG] py2app: How can I run tests using the bundled python interpreter?

Berg, Stuart bergs at janelia.hhmi.org
Fri Nov 1 21:10:35 CET 2013


Hi all,

I just posted a question about py2app to stackoverflow:
http://stackoverflow.com/questions/19734558/py2app-how-can-i-run-tests-using-the-bundled-python-interpreter

For your convenience, I've also pasted the question below.  Any responses (via your preferred venue :-) are much appreciated.

Many thanks,
Stuart

I use py2app to package my application.  A few quick notes about my app:

- It uses a special python executable (i.e. non-system python), which py2app includes in the bundle.
- I explicitly exclude a few packages from site-packages.zip using the py2app recipe feature.

In the past, I've sometimes had issues with my app bundle because I forgot to exclude certain packages from site-packages.zip.  This was easy to fix once I discovered the problem, but I wasn't quick to discover it because the packages in question *mostly* worked.  The problem only showed itself after testing special cases that happen to exercise specific submodules in the problematic dependency.

In order to avoid problems like this in the future, I want to run a test suite using the same exact interpreter that py2app includes in my bundle.  For that to work, I need the proper environment setup that is somehow automatically created when the app starts up (including PYTHONPATH, DYLD_LIBRARY_PATH, etc.).

Just using ./dist/MyBundle.app/Contents/MacOS/python to run my tests doesn't seem to do the trick.  What's the recommended method to run tests on the fully built app bundle itself?



More information about the Pythonmac-SIG mailing list