将测试结果从unittest、nose、py.test、twisted trial、behave(python 2.6+)发送到Teamcity Continuous Integration Server
teamcity-messages的Python项目详细描述
这个包将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
联系信息
https://github.com/JetBrains/teamcity-messages
Teamcity支持:http://www.jetbrains.com/support/teamcity
许可证
apache,2.0版http://www.apache.org/licenses/LICENSE-2.0
更改日志
- 版本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日星期三
- flake8: 3.x support (Marc Abramowitz, https://github.com/msabramo)
- flake8: –no-teamcity option for 3.x
版本1.19 Sun Jun 26 2016
- fix flake8 2.6.0 support #103 (Cody Maloney, https://github.com/cmaloney)
版本1.18 2016年5月27日星期五
- pytest: do not report setup fixtures as separate tests (https://github.com/JetBrains/teamcity-messages/issues/91)
- pytest: better test location presentation
- pytest: support for pytest-pep8 and pytest-lint plugins
- nose: make sure to turn reason into string when skipping test #98 (Piyush Gupta, https://github.com/piyushg91)
- twisted: fix twisted failure test reporting #88 (Alexey Larkov, https://github.com/gmlexx)
- flake8: better test name #89 (Marc Abramowitz, https://github.com/msabramo)
- Don’t force a newline at the start of service messages #90 (Gary Donovan, https://github.com/garyd203)
版本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日星期六
- blocks messages support (Marc Abramowitz, https://github.com/msabramo)
版本1.15 2015年8月28日星期五
- Twisted’s trial support (Alexey Larkov, https://github.com/gmlexx)
- nose: fix tests reporting in multiprocess environment, thanks to Lewis Coates, https://github.com/lewisc
- Fix UnicodeEncodeError when sys.stdout.encoding is None, thanks to Marc Abramowitz, https://github.com/msabramo
版本1.14 2015年5月23日星期六
- support python 2.4, 2.5
- nose: report skip test reason (Lewis Coates, https://github.com/lewisc)
版本1.13 2015年3月29日星期日
- report coverage statistics from py.test pytest-cov plugin (Joseph Lombrozo, https://github.com/djeebus)
- flake8 support (Joseph Lombrozo, https://github.com/djeebus)
版本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日星期五
- py.test: limit captured stdout/stderr by 1M per test and send it to TeamCity in chunks of 50K chars
- py.test: automatically enable TeamCity reporting under TeamCity build
- py.test: analyze capture flag of capture plugin and set captureStandardOutput parameter of testStarted accordingly
- py.test: report setup failures as a separate test
- py.test: report captured stdout/stderr (Aron Curzon, https://github.com/curzona) https://github.com/JetBrains/teamcity-messages/issues/12
- py.test: fix parallel tests reporting https://github.com/JetBrains/teamcity-messages/issues/11
版本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日星期五
- Added newlines due to http://youtrack.jetbrains.net/issue/TW-4412
版本1.2 2008年4月10日星期四
- Fixed tests gold data
版本1.1 2008年4月10日星期四
- Fixed README
五版本1.0 2008年4月8日星期二 {bq 22}$