Package: teamcity-messages
This package integrates Python with theTeamCityContinuous Integration
(CI) server. It allows sending“service
messages”from Python code. Additionally, it provides integration with the
following testing frameworks and tools:py.testnoseDjangounittest (Python standard
library)Trial (Twisted)Flake8BehavePyLintInstallationInstall using pip:pip install teamcity-messagesor from source:python setup.py installUsageThis package uses service messages to report the build status to TeamCity.
Seehttps://confluence.jetbrains.com/display/TCDL/Build+Script+Interaction+with+TeamCityfor more detailsunittestIf you wish to use the Python default unittest framework, you should
modify the Test runner, e.g.:importunittestfromteamcityimportis_running_under_teamcityfromteamcity.unittestpyimportTeamcityTestRunnerclassTest(unittest.TestCase):...if__name__=='__main__':ifis_running_under_teamcity():runner=TeamcityTestRunner()else:runner=unittest.TextTestRunner()unittest.main(testRunner=runner)Seeexamples/simple.pyfor a full example.If you are used to running unittest from the command line, instead of
usingpython-munittest, you could usepython-mteamcity.unittestpy.noseTest status reporting is enabled automatically under TeamCity build.py.testTest status reporting is enabled automatically under TeamCity build.DjangoFor Django 1.6+: Use theTeamcityDjangoRunnerrunner instead of the
defaultDiscoverRunnerby changing the following setting in your
settings.py:TEST_RUNNER="teamcity.django.TeamcityDjangoRunner"If you are using another test runner, you should override therun_suitemethod or use theDiscoverRunner.test_runnerproperty
introduced in Django 1.7.flake8Test status reporting is enabled automatically under TeamCity build.PyLintAdd--output-format=teamcity.pylint_reporter.TeamCityReporterto
thepylintcommand line.toxPass TEAMCITY_VERSION environment variable inside your test virtenv.
TEAMCITY_VERSION environment variable exists during build on TeamCity.
teamcity-messages uses it in order to enable reporting to TeamCity.[testenv]
passenv = TEAMCITY_VERSIONTwisted trialAdd--reporter=teamcityoption to trial command lineBehaveFor Behave 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 version compatibilitySeehttps://pypi.org/project/teamcity-messagesfor Python version compatibilityContact informationhttps://github.com/JetBrains/teamcity-messagesTeamCity support:http://www.jetbrains.com/support/teamcityLicenseApache, version 2.0http://www.apache.org/licenses/LICENSE-2.0Change LogVersion 1.32 Tue Sep 27 2022flake8: fix flake8 >= 5 by @itsb #266 #264Version 1.31 Tue Feb 22 2022python: supported Python 3.10escape unencodable messages by @kri-k #261Version 1.30 Fri Dec 17 2021support pylint >= 2.12 by @Tirzono #259pytest: fix assert diffs by @ikonst #247pytest: support swapdiff as option by @throwable-one #244Version 1.29 Fri Jun 25 2021python: supported Python 3.9support pylint >= 2.8 by @Tirzono #242pytest: add an option to swap actual/expected in diffVersion 1.28 Thu Apr 30 2020support coverage >= 5.0.1 by @enkelli #225 #218python: dropped Python 2.6, 3.5 support. Latest version to support them is 1.27python: supported Python 3.8Version 1.27 Fri Nov 8 2019pylint: more compatibility fixes #215Version 1.26 Tue Nov 5 2019drop Python 3.4 supportpylint: support pylint >= 2.3 by @PetrWolf #215unittest: fix test hierarchy for subtests in tests with doc comments by @throwable-one #221Version 1.25 Mon Apr 15 2019pytest: fix comparing asserts by @ikonst #210Retry writes to stream on a EAGAIN IOError by @morganwahl #213Version 1.24 Mon Mar 18 2019pylint: initial support by @PetrWolf #171 #200Version 1.23 Sun Mar 10 2019Correct supported python versions, description, keywordsVersion 1.22 Sun Mar 10 2019python: dropped Python 2.4, 2.5, 3.2, 3.3 support. Latest version to support them is 1.21python: supported Python 3.6, 3.7behave: initial supportunittest: subtests supportvarious unicode fixesnose, unittest: correctly capture stdout to provide better test outputtwisted: format twisted Failure objects by @jackrobisonvarious test infrastructure fixes by @sambrightmanflake8: correctly initialize options by @sambrightmanvarious fixes to use teamcity-messages code in JetBrains PyCharm IDEVersion 1.21 Mon Jan 2 2017pytest: internal Error during test collection with pytest and teamcity-messages plugin #112nose: support capturing test output from successful tests, #113Fix possible error when joining bytes and unicode (Victor Makarov,https://github.com/vitek)Version 1.20 Wed Aug 3 2016flake8: 3.x support (Marc Abramowitz,https://github.com/msabramo)flake8: –no-teamcity option for 3.xVersion 1.19 Sun Jun 26 2016fix flake8 2.6.0 support #103 (Cody Maloney,https://github.com/cmaloney)Version 1.18 Fri May 27 2016pytest: do not report setup fixtures as separate tests (https://github.com/JetBrains/teamcity-messages/issues/91)pytest: better test location presentationpytest: support for pytest-pep8 and pytest-lint pluginsnose: 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 2015support coverage >= 4.0automatically 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 etcVersion 1.16 Sat Sep 12 2015blocks messages support (Marc Abramowitz,https://github.com/msabramo)Version 1.15 Fri Aug 28 2015Twisted’s trial support (Alexey Larkov,https://github.com/gmlexx)nose: fix tests reporting in multiprocess environment, thanks to Lewis Coates,https://github.com/lewiscFix UnicodeEncodeError when sys.stdout.encoding is None, thanks to Marc Abramowitz,https://github.com/msabramoVersion 1.14 Sat May 23 2015support python 2.4, 2.5nose: report skip test reason (Lewis Coates,https://github.com/lewisc)Version 1.13 Sun Mar 29 2015report 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 2015unittest: fix 2.6 compatVersion 1.11 Fri Jan 16 2015nose: handle errors/failures in teardown/setupnose: support multiprocess modenose: correctly report captured outputunittest: support skipped tests in Python 2.6 (by unittest2)unittest: support subtests (Python 3.4+)Version 1.10 Fri Jan 09 2015py.test: limit captured stdout/stderr by 1M per test and send it to TeamCity in chunks of 50K charspy.test: automatically enable TeamCity reporting under TeamCity buildpy.test: analyze capture flag of capture plugin and set captureStandardOutput parameter of testStarted accordinglypy.test: report setup failures as a separate testpy.test: report captured stdout/stderr (Aron Curzon,https://github.com/curzona)https://github.com/JetBrains/teamcity-messages/issues/12py.test: fix parallel tests reportinghttps://github.com/JetBrains/teamcity-messages/issues/11Version 1.9 Thu Jan 08 2015Django support (Ralph Broenink,https://github.com/ralphje)Fix test hierarchies on nose and py.testpy.test: report errors in setup and teardownpy.test: report collect errorspy.test: support xfailnose: support skipped testsunittest: support skip, expected failure and unexpected successTotally 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 2014extensive tests for nose integration (James Carpenter)added timestamps to TeamCity service messages (James Carpenter)Version 1.7 Sun Feb 03 2013py.test support (Aaron Buchanan)official Python 3 supportVersion 1.6 Tue Dec 06 2011Bundle forgotten examples/simple.pyVersion 1.4 Tue Apr 27 2010Fixedhttp://youtrack.jetbrains.net/issue/TW-11313Version 1.3 Fri Apr 11 2008Added newlines due tohttp://youtrack.jetbrains.net/issue/TW-4412Version 1.2 Thu Apr 10 2008Fixed tests gold dataVersion 1.1 Thu Apr 10 2008Fixed READMEVersion 1.0 Tue Apr 08 2008initial release