Coder Social home page Coder Social logo

ralphje / teamcity-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jetbrains/teamcity-messages

0.0 3.0 0.0 3.08 MB

Python Unit Test Reporting to TeamCity

Home Page: http://confluence.jetbrains.com/display/TW/Python+Unit+Test+Reporting

Python 100.00%

teamcity-python's Introduction

TeamCity plugin for unittest

This packages provides unittest, nose and py.test addons for sending test result messages to TeamCity continuous integration server http://www.jetbrains.com/teamcity/

Installation

pip install teamcity-messages

or

python setup.py install

if you have extracted version or Github checkout

Usage

unittest Use the TeamcityTestRunner as your test runner to report messages to TeamCity. f you wish to print usual diagnostics without it, you could use something like:

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

nose Test status reporting is enabled automatically under TeamCity build.

py.test Run with --teamcity command line option.

See http://www.jetbrains.net/confluence/display/TCD3/Build+Script+Interaction+with+TeamCity for more details

Tests

This package integrates with different test framework and therefore requires some special testing. In the tests folder, there are two additional folders: test_output and test_scripts. Each supported test framework has their own test script (or module) that is executed from here. This test spawns an additional python process for each supported framework. The output of this command is compared with the 'gold' files in the test_output folder.

There are two ways to run tests. The first is to simply run the unittests at tests/core.py. This requires py.test and nose to be installed. (This is identical to running python setup.py test.) It is recommended to create a virtualenv before running these tests. Note that you can run these tests using your favorite test framework, but for reporting to TeamCity you probably require this module itself, which is a somewhat circular dependency.

The second method involves running test.py. This module requires virtualenv to be installed in your current env and create a new virtualenv for each supported test framework. A new Python process is opened within this env, and this process will then in turn run a single unit test. Since we use pip to install the required packages in the env, you do not need to install py.test and nose in your main env. Additionally, this module offers some basic reporting features for TeamCity.

Contact information

https://github.com/JetBrains/teamcity-python

TeamCity support: http://www.jetbrains.com/support/teamcity

License

Apache, version 2.0 http://www.apache.org/licenses/LICENSE-2.0

teamcity-python's People

Contributors

aaronb-inova avatar leo-from-spb avatar petrwolf avatar ralphje avatar shalupov avatar thedrow avatar

Watchers

 avatar  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.