1

I have a set of Python tests that run on TeamCity. I am able to get the test to run, however I cannot get TeamCity to produce a test report. How can I get TeamCity to produce a report of my tests?

Thanks

jzl_Ptyhon
  • 11
  • 1
  • 2

3 Answers3

2

You can install teamcity-messages from PyPI. At that point, you can create a simple script that will replicate the built-in unittest script, with all the same options for discovery, test patterns, etc., but with the TeamCity runner. That runner will output test messages such that TeamCity will understand and report them.

from teamcity.unittestpy import TeamcityTestRunner
import unittest

if __name__ == '__main__':
    unittest.main(testRunner=TeamcityTestRunner())
Eric Smith
  • 2,739
  • 2
  • 30
  • 29
  • Does unittest.main produces the tests to be run automatically? From where does it extract the tests from? What if I have my tests in a test suite, how can I indicate the test suite I want to use here? – cSn Dec 30 '13 at 16:27
  • @cSn - You can run the script above with `-h` to see the options that `unittest.main` provides, including the ability to pass a suite on the command line. – Eric Smith Jan 01 '14 at 17:43
1

Did you see the question TeamCity for Python/Django continuous integration ? I think it has what you need.

Community
  • 1
  • 1
KIR
  • 5,614
  • 1
  • 31
  • 23
0

The test reports are to be generated by the test runner, not TeamCity. TeamCity will only look at the test report generated and use it for purposes like displaying info on the tests passed etc.

manojlds
  • 290,304
  • 63
  • 469
  • 417