openerp unittesting工具包

itsbroken的Python项目详细描述


它可以帮助您为损坏的openerp modules编写单元测试,因为 openerps在测试功能方面没有太多的功能。如果你觉得奇怪 类似于Tryton测试用例,不要 困惑,这项工作的灵感来自于尝试测试。

大师级

https://travis-ci.org/openlabs/itsbroken.png?branch=master

开发

https://travis-ci.org/openlabs/itsbroken.png?branch=develop

许可证tl;dr;

如果要发布使用的模块,此程序将附带一个 AGPL许可证。

如果你想在一个你不想做的模块中使用这个程序 公开,您应该满足以下条件:

  • You have tweeted atleast once with the #sorryopenerp tag (Frequent bugs in Open ERP will push you in the right direction)
  • You have visited the Tryton website atleast once.
  • You believe that code without test is broken code (like Hollywood is incomplete without Julia Roberts)
  • You do not use OpenERP or any modules with the “OpenERP AGPL + Private Use License”

许可证的详细版本可以在许可证文件中看到。

为什么这个执照乱七八糟?

虽然我们百分之百地致力于开源(另请参阅我们的常见问题解答),但我们理解 最终用户有时可能需要使用私有软件。为了解决这个问题 需要,openerp enterprise附带一个特殊的附加权限 致OpenERP Enterprise的每个订户,但仅限于 私人使用。我们认为这是贪婪者对工作的愚蠢剥削 公司。

示例用法

importunittestfromitsbroken.transactionimportTransactionfromitsbroken.testingimportDB_NAME,POOL,USER,CONTEXT, \
    install_module,drop_databaseclassTestItsBroken(unittest.TestCase):"""
    Test the itsbroken library by connecting to an instance of
    OpenERP.

    By defualt OpenERP has the partner module and other core modules
    installed, so most of the test uses those modules.
    """defsetUp(self):install_module('product')deftest_0010_create(self):"""
        Test by creating a new product
        """withTransaction().start(DB_NAME,USER,CONTEXT)astxn:product_obj=POOL.get('product.product')values={'name':'Sharoon Thomas'}id=product_obj.create(txn.cursor,txn.user,values,txn.context)product=product_obj.browse(txn.cursor,txn.user,id)self.assertEqual(product.name,values['name'])if__name__=='__main__':unittest.main()

更多示例

这个模块本身的测试是一个很好的例子,说明了如何使用它的breaked for 测试。见tests/test_itsbroken.py

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java我能知道文件的哪个条目正在被修改吗?   多线程Java并发线程   java抓取包含多个页面的多个字母标签的网站   为什么if语句不排除Java中的另一个if语句?   Java可序列化哈希映射到ByteArray以创建blob   JavaEclipseLombokBuilder添加新建议   java将文件路径数组转换为文件数组,并计算每个文件的大小   在Java8流中添加大小数   Bouncy Castle 1.46之前版本的java兼容性问题   无法在AWS设备场上运行安卓 Java Appium测试   java为什么不使用mavenwarplugin将键与“WEBINF/classes/METAINF/MANIFEST.MF”合并?   java如何在引用子类的成员时调用super()   找不到java TestFx无头MonoclePlatformFactory   java AbstractMethodError onClientSessionEvent和“缺少控制媒体的权限”   正则表达式如何使用JAVA在字符串的大写字母前插入空格?   我的Spring安全项目中的java BCrypt(Spring安全)   java在我的网站上查看小程序更新时遇到问题   java如何使用schedule方法