PY-23926: Check teamcity plugin via setuptools api and do not add it

if already registered.
This commit is contained in:
Ilya.Kazakevich
2017-07-12 23:25:05 +03:00
parent 3cd5240969
commit b82eb6f220
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -7,8 +7,7 @@ from _pytest.config import get_plugin_manager
from _jb_runner_tools import jb_start_tests, jb_patch_separator, jb_doc_args, JB_DISABLE_BUFFERING
from teamcity import pytest_plugin
from pkg_resources import iter_entry_points
if __name__ == '__main__':
path, targets, additional_args = jb_start_tests()
@@ -22,7 +21,8 @@ if __name__ == '__main__':
# to prevent "plugin already registered" problem we check it first
plugins_to_load = []
if not get_plugin_manager().hasplugin("pytest-teamcity"):
plugins_to_load.append(pytest_plugin)
if "pytest-teamcity" not in map(lambda e:e.name, iter_entry_points(group='pytest11', name=None)):
plugins_to_load.append(pytest_plugin)
args = sys.argv[1:]
if JB_DISABLE_BUFFERING and "-s" not in args:
+1 -1
View File
@@ -12,7 +12,7 @@ envs {
packages = ["pip", "setuptools"]
_64Bits = true
conda "django19", "2.7", ["django==1.9", "tox", "nose", "pytest", "behave", "lettuce>=0.2.22", "unittest2"], true
conda "django19", "2.7", ["django==1.9", "tox", "nose", "pytest", "behave", "lettuce>=0.2.22", "unittest2", "teamcity-messages"], true
textfile "django19/tags.txt", "python2.7\ndjango\nnose\npytest\nbehave\nlettuce\npackaging\ntox\nunittest2"
conda "django110", "3.4", ["django==1.10", "django-nose"], false