GithubHelp home page GithubHelp logo

fjuza / teamcity-messages Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jetbrains/teamcity-messages

0.0 2.0 0.0 3.4 MB

Python Unit Test Reporting to TeamCity

Home Page: https://pypi.python.org/pypi/teamcity-messages

License: Other

Python 99.66% Gherkin 0.34%

teamcity-messages's Introduction

Python Unit Test Reporting to TeamCity

This package integrates Python with the TeamCity Continuous Integration (CI) server. It allows 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 the build status to TeamCity. See https://confluence.jetbrains.com/display/TCDL/Build+Script+Interaction+with+TeamCity for more details

unittest

If you wish to use the Python default 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.

PyLint

Add --output-format=teamcity.pylint_reporter.TeamCityReporter to the pylint command line.

tox

Pass 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_VERSION

Twisted trial

Add --reporter=teamcity option to trial command line

Behave

For Behave 1.2.6:

from behave.formatter import _registry
from behave.configuration import Configuration
from behave.runner import Runner
from teamcity.jb_behave_formatter import TeamcityFormatter

_registry.register_as("TeamcityFormatter", TeamcityFormatter)
configuration = Configuration()
configuration.format = ["TeamcityFormatter"]
configuration.stdout_capture = False
configuration.stderr_capture = False
Runner(configuration).run()

Python version compatibility

  • Python 2 - >= 2.6
  • Python 3 - >= 3.3
  • 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

teamcity-messages's People

Contributors

aaronb-inova avatar cmaloney avatar coagulant avatar curzona avatar denisenkom avatar djeebus avatar garyd203 avatar gmlexx avatar ikonst avatar jackrobison avatar julia-alexandrova avatar leo-from-spb avatar mfogel avatar msabramo avatar petrwolf avatar ralphje avatar sambrightman avatar shalupov avatar thedrow avatar throwable-one avatar tugloo1 avatar vitek avatar vtitor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.