一起使用django-nose和django-celery-单元测试 [英] Using django-nose and django-celery together -- unit testing

查看:142
本文介绍了一起使用django-nose和django-celery-单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 django-nose 的django项目.我想将 django-celery 添加到项目中.我使用单元测试. django-nose和django-celery都需要在我的settings.py文件中进行TEST_RUNNER设置.具体来说:

I have a django project that used django-nose. I'd like to add django-celery to the project. I use unit tests. Both django-nose and django-celery need a TEST_RUNNER setting in my settings.py file. Specifically:

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

对于django-nose和:

for django-nose and:

TEST_RUNNER = 'djcelery.contrib.test_runner.CeleryTestSuiteRunner'

对于芹菜.

我应该如何处理以便同时使用这两个软件包?

How should I handle this so that I can use both packages?

推荐答案

我发现处理此问题的最佳方法是跳过Celery测试运行程序.我只用@override_settings(CELERY_ALWAYS_EAGER=True)装饰芹菜使用的测试,一切都得到了很好的测试.

I found that the best way to handle this is to skip the Celery test runner. I just use decorate my celery-using tests with a @override_settings(CELERY_ALWAYS_EAGER=True) and everything gets tested nicely.

这篇关于一起使用django-nose和django-celery-单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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