在django testsuite中摆脱空的models.py [英] Getting rid of empty models.py in django testsuite

查看:196
本文介绍了在django testsuite中摆脱空的models.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个纯服务应用程序,作为我的核心模型的仆人。因此,他们没有任何自己的模型。



虽然第一个服务的测试运行正常,但第二个提示出错以下错误:

  django.core.exceptions.ImproperlyConfigured:
带有标签位置的应用程序缺少models.py模块。

如果我添加一个空的models.py,套件运行正常。



我不能在应用程序之间的架构/结构方面发现差异。但是我想摆脱空的,不需要的models.py。



我该怎么做?

解决方案

更新:现在可以提出您的要求。使用Django 1.7,您不再需要 models.py 文件。 - 发行说明



以前:Django测试需要每个应用都有一个 models.py 文件。可以把它留空(或者有用的评论!)。关于没有型号的应用程序的票证讨论。直接从代码(添加在 1.4 /仍在 1.5 ):


测试运行器当前不会加载没有models.py文件的测试模块



I have two pure service apps, that act as servant to my core models. Hence, they do not have any own models.

While the testsuite for the first service runs fine, the second throws the following error:

django.core.exceptions.ImproperlyConfigured: 
App with label location is missing a models.py module. 

If I add an empty models.py, the suite runs fine.

I can't spot a difference in terms of architecture / structure between the apps. But I want to get rid of the empty, unneeded models.py.

How would I do that?

解决方案

Update: What you ask is now possible. With Django 1.7 you no longer need a models.py file. -release notes

Previously: Django testing requires every app to have a models.py file. It's okay to leave it empty (or with a helpful comment!). Ticket discussion on the matter of apps without models. Direct from the code (added in 1.4/still in 1.5):

the test runner won't currently load a test module with no models.py file

这篇关于在django testsuite中摆脱空的models.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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