Running Django's 'manage.py test' within WingIDE
Posted by Gene at
12:04 on Wed 14 Apr 2010
-- 1 Comments
One of the powerful features of WingIDE is that you can debug python code, even web applications and Django, with an interactive debugger that is fast and very feature full.
In this article I discuss how I use it with Django. Suppose you have a unit test that hits a relational DB. With Django you can run python manage.py test, to run these tests. When you test this way, Django will do the following
- Create a test database, syncdb your tables, and load any data fixtures
- Run the tests
- Drop the test database
WingIDE has a Unit Testing interface, but it only allows you to run the tests. In other words, it only runs Step 2 above. I have found no easy way to have Wing do Step 1, then run your selected tests within Wing's Testing system, then do Step 3. I'm working on a way to do this, and will blog about it someday. For now, I run the Django Test system through Wing Debug system, and not through the testing system. Like this.
- In your Django project, in Wing, Choose to edit the file properties for manage.py.
- In the 'Debug' tab of this dialog, and the 'Run Arguments' box type test (and optionally the app name to run tests just for that app).
- Now choose to Debug manage.py by right clicking on that file and choosing Debug Selected
This will cause WingIDE to run the Django test framework. Output will go into the Debug I/O panel. Wing will even stop at breakpoints and enter the debugger.
The advantages of this method
The tests can be run either on the commandline or within WingIDE without any changes or hacks to the source and it is simple to set up.
The disadvantages of this method
You don't get to use the rich Wing interface for running tests which would allow you to run individual tests on demand. Beware too that you might be using manage.py to run the Django runserver within WingIDE. That is also configured in the manage.py Debug dialog. You can only configure one argument to manage.py at a time.
Damn it, i was not aware of Wing4 ! This is what i've been looking for.
- YngwieMalmsteenvery awesome
- Daz