Send test results to TeamCity continuous integration server from unittest, nose, py.test, twisted trial (Python 2.4+)
Project description
This packages integrates Python with the TeamCity Continuous Integration (CI) server. It allow sending “service messages” from Python code. Additionally, it provides integration with the following testing frameworks and tools:
Installation
Install using pip:
pip install teamcity-messages
or from source:
python setup.py install
Usage
This package uses service messages to report build status to TeamCity. See https://confluence.jetbrains.com/display/TCD9/Build+Script+Interaction+with+TeamCity for more details
unittest
If you wish to use Python default’s unittest framework, you should modify the Test runner, e.g.:
import unittest
from teamcity import is_running_under_teamcity
from teamcity.unittestpy import TeamcityTestRunner
class Test(unittest.TestCase):
...
if __name__ == '__main__':
if is_running_under_teamcity():
runner = TeamcityTestRunner()
else:
runner = unittest.TextTestRunner()
unittest.main(testRunner=runner)
See examples/simple.py for a full example.
If you are used to running unittest from the command line, instead of using python -m unittest, you could use python -m teamcity.unittestpy.
nose
Test status reporting is enabled automatically under TeamCity build.
py.test
Test status reporting is enabled automatically under TeamCity build.
Django
For Django 1.6+: Use the TeamcityDjangoRunner runner instead of the default DiscoverRunner by changing the following setting in your settings.py:
TEST_RUNNER = "teamcity.django.TeamcityDjangoRunner"
If you are using another test runner, you should override the run_suite method or use the DiscoverRunner.test_runner property introduced in Django 1.7.
flake8
Test status reporting is enabled automatically under TeamCity build.
Twisted trial
Add --reporter=teamcity option to trial command line
Python version compatibility
Python 2 - >= 2.4
Python 3 - >= 3.2
PyPy and PyPy 3
Jython
Contact information
https://github.com/JetBrains/teamcity-messages
TeamCity support: http://www.jetbrains.com/support/teamcity
License
Apache, version 2.0 http://www.apache.org/licenses/LICENSE-2.0
Change Log
Version 1.20 Wed Aug 3 2016
flake8: 3.x support (Marc Abramowitz, https://github.com/msabramo)
flake8: –no-teamcity option for 3.x
Version 1.19 Sun Jun 26 2016
fix flake8 2.6.0 support #103 (Cody Maloney, https://github.com/cmaloney)
Version 1.18 Fri May 27 2016
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)
Version 1.17 Sat Oct 17 2015
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
Version 1.16 Sat Sep 12 2015
blocks messages support (Marc Abramowitz, https://github.com/msabramo)
Version 1.15 Fri Aug 28 2015
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
Version 1.14 Sat May 23 2015
support python 2.4, 2.5
nose: report skip test reason (Lewis Coates, https://github.com/lewisc)
Version 1.13 Sun Mar 29 2015
report coverage statistics from py.test pytest-cov plugin (Joseph Lombrozo, https://github.com/djeebus)
flake8 support (Joseph Lombrozo, https://github.com/djeebus)
Version 1.12 Fri Jan 16 2015
unittest: fix 2.6 compat
Version 1.11 Fri Jan 16 2015
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+)
Version 1.10 Fri Jan 09 2015
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
Version 1.9 Thu Jan 08 2015
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)
Version 1.8 Sat Feb 08 2014
extensive tests for nose integration (James Carpenter)
added timestamps to TeamCity service messages (James Carpenter)
Version 1.7 Sun Feb 03 2013
py.test support (Aaron Buchanan)
official Python 3 support
Version 1.6 Tue Dec 06 2011
Bundle forgotten examples/simple.py
Version 1.4 Tue Apr 27 2010
Version 1.3 Fri Apr 11 2008
Added newlines due to http://youtrack.jetbrains.net/issue/TW-4412
Version 1.2 Thu Apr 10 2008
Fixed tests gold data
Version 1.1 Thu Apr 10 2008
Fixed README
Version 1.0 Tue Apr 08 2008
initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.