Exemplo n.º 1
0
import sys
import imp
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)
from tcmessages import TeamcityServiceMessages
import os

from pycharm_run_utils import adjust_sys_path

adjust_sys_path(False)

messages = TeamcityServiceMessages(prepend_linebreak=True)
messages.testMatrixEntered()
try:
  import pytest
  PYVERSION = [int(x) for x in pytest.__version__.split(".")]
except:
  import py
  PYVERSION = [int(x) for x in py.__version__.split(".")]

def get_name(nodeid):
  return nodeid.split("::")[-1]

def fspath_to_url(fspath):
  return "file:///" + str(fspath).replace("\\", "/")

if PYVERSION > [1, 4, 0]:
  items = {}
  current_suite = None
  current_file = None
  current_file_suite = None

  def pytest_runtest_logstart(nodeid, location):
    path = "file://" + os.path.realpath(location[0])
    if location[1]:
Exemplo n.º 3
0
import os
import sys
helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0])
if sys.path[0] != helpers_dir:
    sys.path.insert(0, helpers_dir)

from tcmessages import TeamcityServiceMessages
from pycharm_run_utils import adjust_sys_path

adjust_sys_path(False)

# Directory where test script exist
CURRENT_DIR_NAME = ""
if sys.argv:
  last_arg = sys.argv[-1]

  if os.path.isfile(last_arg):
    CURRENT_DIR_NAME = os.path.dirname(last_arg)
  else:
    CURRENT_DIR_NAME = last_arg
    if not str(last_arg).endswith(os.sep):
      CURRENT_DIR_NAME = last_arg + os.sep

messages = TeamcityServiceMessages(prepend_linebreak=True)
if not "_jb_do_not_call_enter_matrix" in os.environ:
  messages.testMatrixEntered()
try:
  import pytest
  PYVERSION = [int(x) for x in pytest.__version__.split(".")]
except:
  import py
Exemplo n.º 4
0
import sys
import imp
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)