Take the 2-minute tour ×

We have recently moved away from our custom test runner / discovery tool in favor of py.test. For proper unit test reporting when running under teamcity there exists a pytest plugin: https://github.com/JetBrains/teamcity-python

When installed with:

python setup.py install

The plugin is discovered correctly by pytest. However, we don't want to install pytest & this plugin on our build machines. Instead we would rather have them packaged as part of our projects "tools" directory.

How do install / configure py.test to "discover" this plugin. We have tried adding pytest_plugins = "teamcity" with several variations to the setup.cfg file of pytest with no success.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

There is no "pytest_plugins" configuration variable (see output at the end of "py.test -h). However, the env var "PYTEST_PLUGINS" contains comma-separated python import paths. So if you plugin is in "teamcity/util/myplugin.py" you would set it like this:

export PYTEST_PLUGINS=teamcity.util.myplugin

You can also use a command line option "-p teamcity.util.myplugin" to achieve a similar effect. And then add it to your setup.cfg's section:

addopts = -p teamcity.util.myplugin
share|improve this answer
Thanks! I went with the 'addopts' to my pytest configuration and it found the plugin with not difficulties. –  Jesse Feb 9 '13 at 20:14

Your Answer


