zoukankan      html  css  js  c++  java
  • Python Test in Hudson

    在hudson(现在名称为Jenkins)中集成Python时,参考此文,收录用作参考。

    原文参考:http://www.wallix.org/2011/06/29/how-to-use-jenkins-for-python-development/

    At Wallix, we are mainly developing under 2 main environments C/C++ and python. In this article, we are going to cover how we have used Jenkins in our python development process.

    We have chosen Jenkins as our continuous integration platform because it supports a wide range of external tools. So far, we have integrated the following features and tools:

    • integration with our version control system subversion and git to launch periodic build and checks when modifications arise;
    • unit and integration test runners;
    • sloccount to have metrics about lines of codes;
    • pylint and pyflakes for python code analysis;
    • clonedigger for duplicate code detection;
    • integration with our ticket management system redmine.

    Plugins

    To be able to integrate these tools, you need to install these extra plugins:

    Then you have to configure these plugins in your project settings page. We are going to give advices for each plugins in the following sections.

    SLOCCount

    You need sloccount installed in your path of course and then you have to add the following shell script step in your build process:

    sloccount --duplicates --wide --details . | fgrep -v .svn > sloccount.sc || :

    This will create the sloccount.sc file in your workspace during the build process. You have to active the Publish SLOCCount analysis results checkbox and configure the file name in theSLOCCount reports entry field.

    Unit tests

    We use nosetest to drive our unit tests. You need to add the following shell script test in your build process:

    find . -name test*.py|xargs nosetests --with-xunit --verbose || :

    and then provide nosetests.xml as the name of the JUnit file.

    Pyflakes

    Pyflakes is integrated through the Warnings plugin. You have to add the following shell build step:

    find . -name *.py|egrep -v '^./tests/'|xargs pyflakes  > pyflakes.log || :

    And then add pyflakes.log as the file pattern for the Scan for compiler warnings option.

    Pylint

    Pylint is integrated with the Violation plugin. You have to add the following shell build step:

    rm -f pylint.log
    for f in `find . -name *.py|egrep -v '^./tests/'`; do
    pylint --output-format=parseable --reports=y $f >> pylint.log
    done || :

    Then add pylint.log in the Report violations table for the pylint line.

    Clone digger

    Clone digger is integrated through the Violation plugin. You have to add the following shell build step:

    python ~/clonedigger/clonedigger/clonedigger.py --cpd-output . || :

    and then add output.xml in Report violations table for the cpd line.

    Feedback

    We want to ear from you! Do you use the tools the same way we do? Do you use other tools?

    Incoming search terms:

    • jenkins python
    • python jenkins
    • jenkins pylint
    • how to use jenkins
    • pylint jenkins
    • pyflakes jenkins
    • jenkins pyflakes
    • jenkins nosetests
    • jenkins python plugin
    • jenkins for python

    赠人玫瑰
    手留余香

    我们曾如此渴望命运的波澜,到最后才发现:人生最曼妙的风景,竟是内心的淡定与从容……我们曾如此期盼外界的认可,到最后才知道:世界是自己的,与他人毫无关系!-杨绛先生

    如果,您认为阅读这篇博客让您有些收获,不妨点击一下右下角的推荐按钮。
    如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的关注我

  • 相关阅读:
    vuePress搭建属于自己的站点。
    webpack打包取消所有的console.log语句
    浏览器使用input复制不成功解决办法。
    腾讯地图marker中大小的控制和事件绑定。
    VUE开发公众号IOS9白屏问题
    head.s 简单分析
    linux内核初始化控制流
    一直小菜鸟在学习飞翔。
    8种主要排序算法的C#实现
    我的Jquery参考词典
  • 原文地址:https://www.cnblogs.com/haochuang/p/2538463.html
Copyright © 2011-2022 走看看