当我的项目(Django)发生任何变化时,如何自动运行测试? [英] How to automatically run tests when there's any change in my project (Django)?

查看:88
本文介绍了当我的项目(Django)发生任何变化时,如何自动运行测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我在django项目中进行了重大更改之后,每隔一段时间运行 python manage.py test 。当我在项目中更改并保存文件时,是否可以自动运行这些测试?以前检测错误会很有用(我知道rails使用rspec有这样的东西)。我正在使用鼻子和django鼻子。感谢提前。

At the moment I am running python manage.py test every once in a while after I make significant changes in my django project. Is it possible to run those tests automatically whenever I change and save a file in my project? It'll be useful to detect bugs earlier (I know rails has something like this with rspec). I am using nose and django-nose. Thanks in advance.

推荐答案

使用 entr

$ find . -name '*.py' | entr python ./manage.py test

或者额外的信用,将它与 ack

Or, for extra credit, combine it with ack:

$ ack --python | entr python ./manage.py test

如果您希望在添加新文件时找到新文件:

If you want it to even find new files as you add them:

$ until ack -f --python | entr -d python ./manage.py test; do sleep 1; done

这篇关于当我的项目(Django)发生任何变化时,如何自动运行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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