How to configue Pydev test runner to use Docker
I am developing a Django app or two using pydev as my IDE. I like it a lot 🙂 However, I recently got really excited about Docker and am using Docker and Fig to serve my application now. My problem is that I would like to run my tests in this build environment- seems like this is kinda the point after all!
I know how to actually do it.
fig run web python3 /code/manage.py test
would run the tests. If I didn’t want to use the Django runner, I could run
fig run web python3 /code/myapp/tests.py
Either way though, I cannot figure out how to issue that command from the IDE. All of the run configurations point to the configured python.exe … does anyone know if there is a way to replace that with a fully customized command?
One Solution collect form web for “How to configue Pydev test runner to use Docker”
Well, the PyDev launch configuration is really targeted towards running Python, but there are alternatives to running it through other ways:
Create an external tool run (run > external tools > external tools configuration): You should be able to run anything you want from there… the downside is that this isn’t really integrated into PyDev, so, if you have stack-traces they won’t be clickable (and you won’t be able to debug either).
Create a launcher script which in turn uses subprocess to launch the command you want… if you redirect things tracebacks should be clickable. The downside is that you won’t be able to create a debug session either — but you can still use the remote debugging in this case (http://pydev.org/manual_adv_remote_debugger.html)
Improve PyDev to do that better… (i.e.: get the code: http://pydev.org/developers.html and add docker support to a project through fig — it should be something close to org.python.pydev.django which has special integration for running in django — with some tweaks to the start command line, even starting in debug mode directly can work here)… if you decide to go that route, you can create a feature request at https://sw-brainwy.rhcloud.com/tracker/PyDev/ and ask code-related stuff and I’ll help 🙂
Possibly you can create a custom executable which acts like Python but in reality just forwards things to other places (i.e.: to fig run) — I haven’t actually tested this, but in theory it should work (in the past there was work to support dummy ‘python’ runners such as that — i.e.: for supporting http://cctbx.sourceforge.net/ — so, it should work — but you still have to create this launcher script for your use case to pass things to fig run). If the work is done properly, the debugger could work here too.