There is a Nose plugin that automatically detects when tests are being run from inside the TeamCity. This conveniently captures test results and communicates them with TeamCity. With this recipe, we will explore how to setup a CI job inside TeamCity that runs our tests and then manually invokes that job.
The following steps are needed to get us prepared to run a TeamCity CI job:
pip install teamcity-nose
.TeamCity/bin
directory../runAll.sh start
.http://localhost:8111
.gturnquist$ mkdir /tmp/recipe48
gturnquist$ git init /tmp/recipe48 Initialized empty Git repository in /private/tmp/recipe48/.git/
gturnquist$ cp cart.py /tmp/recipe48/ gturnquist$ cp tests.py /tmp/recipe48/ gturnquist$ cd /tmp/recipe48/ gturnquist$ git add cart.py tests.py gturnquist$ git commit -m "Added shopping cart and tests to setup this recipe." [master (root-commit) ccc7155] Added shopping cart and tests to setup this recipe. 2 files changed, 55 insertions(+), 0 deletions(-) create mode 100644 cart.py create mode 100644 tests.py
The following steps will show us how to configure a CI job in TeamCity:
/tmp/recipe48
as the Fetch URL.. /Users/gturnquist/ptc/bin/activate nosetests tests.py
You need to customize this with the command needed to activate your virtualenv.
This plugin is designed not to be used in the classic style of being invoked by a command-line argument. Instead, it is automatically run whenever nosetests is executed, and it checks if there is a TeamCity-specific environment variable set. If so, it kicks in by printing out viewable results as well as sending back useful information to TeamCity.
Otherwise, the plugin lets itself be bypassed and does nothing. If the plugin was NOT installed, the following screenshot would be the output:
In turn, drilling into the details shows the following output with little detail. There are four periods, one for each test method, but we don't know much more than that.
This means no extra arguments are needed to use the TeamCity plugin, but running it from the command line, outside of TeamCity, causes no changes.
3.145.7.208