V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
loveshouhu
V2EX  ›  pytest

关于Python单元测试框架

  •  
  •   loveshouhu · 2014-01-08 11:52:24 +08:00 · 8177 次点击
    这是一个创建于 3732 天前的主题,其中的信息可能已经有所发展或是发生改变。
    最近想了解点关于Python单元测试框架的东西。
    大家有推荐吗。

    百度了一下,没发现特别有分析性的文字。

    PyUnit nose 什么的有推荐吗?
    12 条回复    1970-01-01 08:00:00 +08:00
    hhrmatata
        1
    hhrmatata  
       2014-01-08 12:20:55 +08:00   ❤️ 1
    你应该Google一下,就有答案了。
    suckli
        2
    suckli  
       2014-01-08 12:25:51 +08:00   ❤️ 1
    polythene
        3
    polythene  
       2014-01-08 12:53:16 +08:00
    LZ你就从了unittest吧
    pyKun
        4
    pyKun  
       2014-01-08 13:00:12 +08:00
    fdsfsdfsdf3334
        5
    fdsfsdfsdf3334  
       2014-01-08 13:09:42 +08:00
    这个能用来测试啥
    loveshouhu
        6
    loveshouhu  
    OP
       2014-01-08 16:39:02 +08:00
    @polythene 雅蠛蝶。。。
    loveshouhu
        7
    loveshouhu  
    OP
       2014-01-08 16:40:35 +08:00
    @fdsfsdfsdf3334 测试代码。 ==
    wenbinwu
        8
    wenbinwu  
       2014-01-08 16:51:31 +08:00   ❤️ 2
    reorx
        9
    reorx  
       2014-01-08 21:57:44 +08:00   ❤️ 2
    @wenbinwu +1 pytest 的文档非常赞,除了 pytest 库本身的使用,也讲了很多非常好的单元测试思想和最佳实践。虽然我主要用 nose,但读过之后还是觉得受益匪浅。

    特别推荐下这一部分,关于如何在项目中组织测试文件的位置: http://pytest.org/latest/goodpractises.html#choosing-a-test-layout-import-rules

    其他关于 Python 测试的资源可以看下我的 pinboard 里的收藏: https://pinboard.in/u:reorx/t:testing/t:python/
    loveshouhu
        10
    loveshouhu  
    OP
       2014-01-08 22:44:03 +08:00
    @reorx 多谢。
    loggerhead
        11
    loggerhead  
       2014-01-09 17:19:36 +08:00
    补充一个:doctest
    1989922yan
        12
    1989922yan  
       2014-01-20 13:05:34 +08:00
    doctest,简单好用
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1038 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:27 · PVG 06:27 · LAX 15:27 · JFK 18:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.