import os import fnmatch helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0]) if sys.path[0] != helpers_dir: sys.path.insert(0, helpers_dir) from tcunittest import TeamcityTestRunner from nose_helper import TestLoader, ContextSuite from pycharm_run_utils import import_system_module from pycharm_run_utils import adjust_sys_path from pycharm_run_utils import debug, getModuleName, PYTHON_VERSION_MAJOR adjust_sys_path() os = import_system_module("os") re = import_system_module("re") modules = {} def loadSource(fileName): baseName = os.path.basename(fileName) moduleName = os.path.splitext(baseName)[0] # for users wanted to run unittests under django #because of django took advantage of module name settings_file = os.getenv('DJANGO_SETTINGS_MODULE') if settings_file and moduleName == "models": baseName = os.path.realpath(fileName) moduleName = ".".join((baseName.split(os.sep)[-2], "models"))
import sys import datetime import os helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0]) if sys.path[0] != helpers_dir: sys.path.insert(0, helpers_dir) from tcunittest import TeamcityTestResult from tcmessages import TeamcityServiceMessages from pycharm_run_utils import import_system_module from pycharm_run_utils import adjust_sys_path, debug, getModuleName, PYTHON_VERSION_MAJOR adjust_sys_path() re = import_system_module("re") doctest = import_system_module("doctest") traceback = import_system_module("traceback") class TeamcityDocTestResult(TeamcityTestResult): """ DocTests Result extends TeamcityTestResult, overrides some methods, specific for doc tests, such as getTestName, getTestId. """ def getTestName(self, test): name = self.current_suite.name + test.source return name def getSuiteName(self, suite):
import sys import datetime import os helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0]) if sys.path[0] != helpers_dir: sys.path.insert(0, helpers_dir) from tcunittest import TeamcityTestResult from tcmessages import TeamcityServiceMessages from pycharm_run_utils import import_system_module from pycharm_run_utils import adjust_sys_path, debug, getModuleName, PYTHON_VERSION_MAJOR adjust_sys_path() re = import_system_module("re") doctest = import_system_module("doctest") traceback = import_system_module("traceback") class TeamcityDocTestResult(TeamcityTestResult): """ DocTests Result extends TeamcityTestResult, overrides some methods, specific for doc tests, such as getTestName, getTestId. """ def getTestName(self, test): name = self.current_suite.name + test.source return name def getSuiteName(self, suite): if test.source.rfind(".") == -1:
#!/usr/bin/env python import os import sys from django.core.management import ManagementUtility from pycharm_run_utils import import_system_module inspect = import_system_module("inspect") #import settings to prevent circular dependencies later on import django.db try: from django.conf import settings apps = settings.INSTALLED_APPS except: pass project_directory = sys.argv.pop() from django.core import management from django.core.management.commands.test import Command try: # setup environment # this stuff was done earlier by setup_environ() which was removed in 1.4 sys.path.append(os.path.join(project_directory, os.pardir)) project_name = os.path.basename(project_directory) __import__(project_name) except ImportError: # project has custom structure (project directory is not importable)
sys.stderr.write("Warning: You are using test runners in legacy mode\n. " "That means you have 'python.tests.enableUniversalTests=false' in registry.\n" "This mode will be dropped in 2021. Consider removing this entry from registry and migrating to new test runners") helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0]) if sys.path[0] != helpers_dir: sys.path.insert(0, helpers_dir) from nose_utils import TeamcityPlugin from pycharm_run_utils import debug, import_system_module from pycharm_run_utils import adjust_sys_path adjust_sys_path(False) shlex = import_system_module("shlex") try: from nose.core import TestProgram from nose.config import Config from nose.plugins.manager import DefaultPluginManager except: raise NameError("Please, install nosetests") teamcity_plugin = TeamcityPlugin() class MyConfig(Config): def __init__(self, **kw): super(MyConfig, self).__init__(**kw) def __setstate__(self, state):
import sys import os helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0]) if sys.path[0] != helpers_dir: sys.path.insert(0, helpers_dir) from nose_utils import TeamcityPlugin from pycharm_run_utils import debug, import_system_module from pycharm_run_utils import adjust_sys_path adjust_sys_path(False) shlex = import_system_module("shlex") try: from nose.core import TestProgram from nose.config import Config from nose.plugins.manager import DefaultPluginManager except: raise NameError("Please, install nosetests") teamcity_plugin = TeamcityPlugin() class MyConfig(Config): def __init__(self, **kw): super(MyConfig, self).__init__(**kw) def __setstate__(self, state): super(MyConfig, self).__setstate__(state)