admin_scripts tests doesn't work on Jython
|Reported by:||leosoto||Owned by:||jacob|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
This set of tests rely on the PYTHONPATH environment variable to set the sys.path of the child python processes it launches and to read the potential location of external backends. But Jython doesn't use PYTHONPATH (nor does IronPython, for the record).
The attached patch fixes this by:
- Tweaking the command line to be executed depending on the current platform.
- Reading the "current PYTHONPATH" from sys.path instead of os.environ['PYTHONPATH'].
It also contains code to remove the compiled files generated from Jython, and avoids a check for the "pyc" extension on the output.
The only drawback I can see is that by using sys.path instead of PYTHONPATH, I've incremented the number places where a pre-existing 'settings.py' file would break the test. Practical example: a settings.py file under <django-root>/tests/.
If it is considered to be worth the effort, this patch could be improved by trying to point the the child's sys.path to only <django-root>, <django-root>/tests/regressiontests/ and <external-backend-root>.
Change History (15)
comment:1 Changed 8 years ago by leosoto
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:8 Changed 8 years ago by ericholscher
- Owner changed from nobody to jacob
- Triage Stage changed from Unreviewed to Accepted