mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-11353 Creating Run Configuration from specific test gets the "target" wrong
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import sys
|
||||
|
||||
from tcunittest import TeamcityTestRunner
|
||||
from tcunittest import TeamcityTestRunner, TeamcityTestResult
|
||||
from tcmessages import TeamcityServiceMessages
|
||||
|
||||
from pycharm_run_utils import adjust_django_sys_path
|
||||
@@ -52,10 +50,41 @@ except ImportError:
|
||||
def __init__(self, stream=sys.stdout, **options):
|
||||
TeamcityTestRunner.__init__(self, stream)
|
||||
|
||||
|
||||
def strclass(cls):
|
||||
if not cls.__name__:
|
||||
return cls.__module__
|
||||
return "%s.%s" % (cls.__module__, cls.__name__)
|
||||
|
||||
class DjangoTeamcityTestResult(TeamcityTestResult):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DjangoTeamcityTestResult, self).__init__()
|
||||
|
||||
def _getSuite(self, test):
|
||||
if hasattr(test, "suite"):
|
||||
suite = strclass(test.suite)
|
||||
suite_location = test.suite.location
|
||||
location = test.suite.abs_location
|
||||
if hasattr(test, "lineno"):
|
||||
location = location + ":" + str(test.lineno)
|
||||
else:
|
||||
location = location + ":" + str(test.test.lineno)
|
||||
else:
|
||||
|
||||
suite = strclass(test.__class__)
|
||||
suite_location = "django_testid://" + suite
|
||||
location = "django_testid://" + str(test.id())
|
||||
|
||||
return (suite, location, suite_location)
|
||||
|
||||
|
||||
class DjangoTeamcityTestRunner(BaseRunner):
|
||||
def __init__(self, stream=sys.stdout, **options):
|
||||
super(DjangoTeamcityTestRunner, self).__init__(stream)
|
||||
|
||||
def _makeResult(self, **kwargs):
|
||||
return DjangoTeamcityTestResult(self.stream, **kwargs)
|
||||
|
||||
def build_suite(self, *args, **kwargs):
|
||||
EXCLUDED_APPS = getattr(settings, 'TEST_EXCLUDE', [])
|
||||
suite = super(DjangoTeamcityTestRunner, self).build_suite(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user