Python Test in Hudson

本文详细介绍了如何在Wallix公司使用Jenkins平台进行Python开发的集成过程,包括版本控制、测试运行、代码分析、代码重复检测以及与红矿等系统的集成。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值