将测试结果从unittest、nose、py.test、twisted trial、behave(python 2.6+)发送到Teamcity Continuous Integration Server

teamcity-messages的Python项目详细描述


Official JetBrains projectApache 2.0 licensePyPI version
Python versions supportedAppVeyor Build StatusTravis Build Status

这个包将python与 TeamCity连续积分 (CI)服务器。它允许发送“service messages” 来自python代码。此外,它还提供了与 以下是测试框架和工具:

安装

使用pip安装:

pip install teamcity-messages

或来源:

python setup.py install

用法

此包使用服务消息向TeamCity报告生成状态。 见https://confluence.jetbrains.com/display/TCDL/Build+Script+Interaction+with+TeamCity 有关详细信息

单元测试

如果希望使用python默认unittest框架,则应该 修改测试运行程序,例如:

importunittestfromteamcityimportis_running_under_teamcityfromteamcity.unittestpyimportTeamcityTestRunnerclassTest(unittest.TestCase):...if__name__=='__main__':ifis_running_under_teamcity():runner=TeamcityTestRunner()else:runner=unittest.TextTestRunner()unittest.main(testRunner=runner)

有关完整示例,请参见examples/simple.py

如果您习惯于从命令行运行unittest,而不是 使用python -m unittest,您可以使用 python -m teamcity.unittestpy

鼻子

在Teamcity Build下自动启用测试状态报告。

py.测试

在Teamcity Build下自动启用测试状态报告。

django

对于django 1.6+:使用TeamcityDjangoRunnerrunner而不是 通过更改 设置.py:

TEST_RUNNER="teamcity.django.TeamcityDjangoRunner"

如果正在使用另一个测试运行程序,则应重写 run_suite方法或使用DiscoverRunner.test_runner属性 在Django 1.7中引入。

薄片8

在Teamcity Build下自动启用测试状态报告。

Pylint

--output-format=teamcity.pylint_reporter.TeamCityReporter添加到 pylint命令行。

毒性

在测试virtenv中传递teamcity_version环境变量。 在TeaTeCudio的构建过程中存在TeaveTyCyVal版本环境变量。 TeamCity消息使用它以便向TeamCity报告。

[testenv]
passenv = TEAMCITY_VERSION

扭曲试验

--reporter=teamcity选项添加到试用命令行

行为

对于行为1.2.6:

frombehave.formatterimport_registryfrombehave.configurationimportConfigurationfrombehave.runnerimportRunnerfromteamcity.jb_behave_formatterimportTeamcityFormatter_registry.register_as("TeamcityFormatter",TeamcityFormatter)configuration=Configuration()configuration.format=["TeamcityFormatter"]configuration.stdout_capture=Falseconfiguration.stderr_capture=FalseRunner(configuration).run()

python版本兼容性

  • Python2->;=2.6
  • Python3->;=3.3
  • Pypy和Pypy 3
  • Jython

更改日志

版本1.25 2019年4月15日周一
  • pytest:fix比较@ikonst 210的断言
  • 通过@morganwahl 213在eagain ioerror上重试写入流
版本1.24 2019年3月18日(星期一)
  • 派林特:最初由@petrwolf 171 200提供支持
版本1.23 2019年3月10日星期日
  • 更正支持的python版本、说明、关键字

版本1.22 2019年3月10日星期日

  • python: dropped Python 2.4, 2.5, 3.2, 3.3 support. Latest version to support them is 1.21
  • python: supported Python 3.6, 3.7
  • behave: initial support
  • unittest: subtests support
  • various unicode fixes
  • nose, unittest: correctly capture stdout to provide better test output
  • twisted: format twisted Failure objects by @jackrobison
  • various test infrastructure fixes by @sambrightman
  • flake8: correctly initialize options by @sambrightman
  • various fixes to use teamcity-messages code in JetBrains PyCharm IDE

版本1.21 2017年1月2日(星期一)

  • pytest: internal Error during test collection with pytest and teamcity-messages plugin #112
  • nose: support capturing test output from successful tests, #113
  • Fix possible error when joining bytes and unicode (Victor Makarov, https://github.com/vitek)

版本1.20 2016年8月3日星期三

版本1.19 Sun Jun 26 2016

版本1.18 2016年5月27日星期五

版本1.17 2015年10月17日星期六

  • support coverage >= 4.0
  • automatically detect TeamCity in flake8 plugin (Marc Abramowitz, https://github.com/msabramo)
  • more messages support (Marc Abramowitz, https://github.com/msabramo) buildProblem, buildStatus, setParameter, importData, enableServiceMessages, disableServiceMessages etc

版本1.16 2015年9月12日星期六

版本1.15 2015年8月28日星期五

版本1.14 2015年5月23日星期六

版本1.13 2015年3月29日星期日

版本1.12 2015年1月16日星期五

  • unittest: fix 2.6 compat

版本1.11 2015年1月16日星期五

  • nose: handle errors/failures in teardown/setup
  • nose: support multiprocess mode
  • nose: correctly report captured output
  • unittest: support skipped tests in Python 2.6 (by unittest2)
  • unittest: support subtests (Python 3.4+)

版本1.10 2015年1月9日星期五

版本1.9 2015年1月8日星期四

  • Django support (Ralph Broenink, https://github.com/ralphje)
  • Fix test hierarchies on nose and py.test
  • py.test: report errors in setup and teardown
  • py.test: report collect errors
  • py.test: support xfail
  • nose: support skipped tests
  • unittest: support skip, expected failure and unexpected success
  • Totally rewritten integration tests * Thanks to Ralph Broenink (https://github.com/ralphje) and Leonid Bushuev (https://github.com/leo-from-spb)

版本1.8 2014年2月8日星期六

  • extensive tests for nose integration (James Carpenter)
  • added timestamps to TeamCity service messages (James Carpenter)

版本1.7 2013年2月3日(星期日)

  • py.test support (Aaron Buchanan)
  • official Python 3 support

版本1.6 2011年12月6日星期二

  • Bundle forgotten examples/simple.py

版本1.4 2010年4月27日星期二

版本1.3 2008年4月11日星期五

版本1.2 2008年4月10日星期四

  • Fixed tests gold data

版本1.1 2008年4月10日星期四

  • Fixed README

五版本1.0 2008年4月8日星期二 {bq 22}$

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

推荐PyPI第三方库


热门话题
JavaSpringMVC控制器测试打印结果JSON字符串   若catch语句返回,那个么为什么它最终会阻塞呢?   java Grails中servletContext在哪里可用?   java Jhipster:如何为现有项目启用多种语言   java异常评估SpringEL表达式:“#fields.hasErrors('something')”   java如何验证SeleniumWebDriver中的文本颜色?   java在绘图时使用JPanel坐标   java如何初始化spring启动到project?   java如何通过JDBC的PreparedStatement将UUID数组插入HyperSQL数据库   java修改JVM以跨线程序列化文件访问   Javascript到Java正则表达式   使用Java运行时调用aspell程序时出现字符集问题。getRuntime()。执行官   执行RDP时的java Sukuli按钮识别   java如何使用okhttp更改connect请求的标头   java无法创建Maven Eclipse项目