V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
ChiangDi
V2EX  ›  Python

调查:大家都在用 Python 的什么单元测试框架

  •  
  •   ChiangDi · 2015-04-07 14:35:40 +08:00 · 3718 次点击
    这是一个创建于 3312 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我在看 kennethreitz 大神写的 http://docs.python-guide.org/en/latest/writing/tests/

    上面介绍了一些测试框架,比如 pytest, nose, tox, unittest2 等等。。

    调查一下大家都在用 Python 的什么单元测试框架?

    18 条回复    2015-04-08 22:32:38 +08:00
    est
        1
    est  
       2015-04-07 14:41:43 +08:00
    我打赌至少一半的人用了一个叫 null 测试的框架。
    ChiangDi
        2
    ChiangDi  
    OP
       2015-04-07 14:59:09 +08:00
    @est 就是不写测试?

    好像 Ruby 社区更加鼓励单元测试,很多人用 Rspec 或者自带的 Minitest。写 Node.js 的很多都用的是 mocha。话说人肉测试真的很痛苦啊。
    messense
        3
    messense  
       2015-04-07 15:02:30 +08:00
    按 unittest 写,然后用 nose 跑。
    ChiangDi
        4
    ChiangDi  
    OP
       2015-04-07 15:08:06 +08:00
    @messense 我自己目前也是这个方案。
    hahastudio
        5
    hahastudio  
       2015-04-07 15:10:05 +08:00   ❤️ 3
    @est 我用的是一个叫 None 测试的框架= =
    jun4rui
        6
    jun4rui  
       2015-04-07 15:11:06 +08:00   ❤️ 1
    另一半里面还有一半是用一个叫print的命令进行测试
    ca1n
        7
    ca1n  
       2015-04-07 15:13:41 +08:00
    @jun4rui = = 中枪
    wuchizhitu1988
        8
    wuchizhitu1988  
       2015-04-07 15:54:57 +08:00
    pytest应该是目前其中最好的了
    grzhan
        9
    grzhan  
       2015-04-07 16:00:52 +08:00
    pytest,文档也写得蛮好的来着
    9hills
        10
    9hills  
       2015-04-07 16:55:17 +08:00
    None: 50%
    print: 25%
    logging: 15%

    其他:10%
    zeayes
        11
    zeayes  
       2015-04-07 17:53:59 +08:00
    nose
    ChiangDi
        12
    ChiangDi  
    OP
       2015-04-07 18:01:33 +08:00
    看来很多人都只是用 python 写写小脚本。严肃的大型项目不写单元测试真是无法想象的。
    Tink
        13
    Tink  
       2015-04-07 18:26:35 +08:00 via iPhone
    @jun4rui 中枪
    FanAndXinran
        14
    FanAndXinran  
       2015-04-07 18:33:44 +08:00
    unittest
    enotx
        15
    enotx  
       2015-04-07 18:37:19 +08:00 via Android
    @jun4rui
    中枪成狗。。。
    libo26
        16
    libo26  
       2015-04-07 22:19:41 +08:00
    同10楼
    kchum
        17
    kchum  
       2015-04-08 00:05:11 +08:00
    @jun4rui 捂脸逃。。。
    ming2281
        18
    ming2281  
       2015-04-08 22:32:38 +08:00
    unittest
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   981 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 23:20 · PVG 07:20 · LAX 16:20 · JFK 19:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.