如何在Eclipse中运行django测试以使调试成为可能,但要在测试数据库上进行 [英] How to run django tests in Eclipse to make debugging possible, but on test database

查看:35
本文介绍了如何在Eclipse中运行django测试以使调试成为可能,但要在测试数据库上进行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很长时间以来,我一直在困扰我.我可以使用Pydev或Nose测试运行程序从Eclipse(Python单元测试)运行测试.这样就可以调试测试并在PyUnit视图中观看它们.但是这样就不会创建测试数据库,不会使用manage.py.

I've got problem concerning me a long time. I either run tests from eclipse (Python unittest) using Pydev or Nose test runner. That way it's possible to debug tests and watch them in PyUnit view. But that way test database is not created, manage.py is not used.

或者我通过manage.py test运行它们-正在创建测试数据库,但是上述功能无法使用该功能.

Or I run them via manage.py test - test db is being created, but above features not available that way.

是否可以在正在测试数据库上运行的eclipse中调试测试?

Is that possible to debug tests in eclipse which are being run on test db?

关于,okrutny

Regards, okrutny

推荐答案

您可以在eclipse中创建新的PyDev django调试配置,并将程序参数设置为"test".

You can create a new PyDev django debug configuration in eclipse and set the program arguments to 'test'.

在这种情况下,调试配置将执行以下命令:"python manage.py test",并且测试用例中的断点将被命中.

In this case, the debug configuration will execute the following command: `python manage.py test' and your breakpoints inside test cases will get hit.

这篇关于如何在Eclipse中运行django测试以使调试成为可能,但要在测试数据库上进行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆