Esempio n. 1
0
def get_all_environments(toxini=None):
    """Get a list of all tox environments.

    :type toxini: str
    :rtype: [tox.config.TestenvConfig]
    """
    if toxini is None:
        config = parseconfig([])
    else:
        config = parseconfig(["-c", toxini])
    envconfigs = sorted(config.envconfigs.values(), key=lambda e: e.envname)
    return envconfigs
Esempio n. 2
0
 def test_summary_status(self, initproj, capfd):
     initproj(
         "logexample123-0.5",
         filedefs={
             "tests": {"test_hello.py": "def test_hello(): pass"},
             "tox.ini": """
         [testenv:hello]
         [testenv:world]
         """,
         },
     )
     config = parseconfig([])
     session = Session(config)
     envs = session.venvlist
     assert len(envs) == 2
     env1, env2 = envs
     env1.status = "FAIL XYZ"
     assert env1.status
     env2.status = 0
     assert not env2.status
     session._summary()
     out, err = capfd.readouterr()
     exp = "%s: FAIL XYZ" % env1.envconfig.envname
     assert exp in out
     exp = "%s: commands succeeded" % env2.envconfig.envname
     assert exp in out
Esempio n. 3
0
 def test_summary_status(self, initproj, capfd):
     initproj(
         "logexample123-0.5",
         filedefs={
             "tests": {
                 "test_hello.py": "def test_hello(): pass"
             },
             "tox.ini":
             """
         [testenv:hello]
         [testenv:world]
         """,
         },
     )
     config = parseconfig([])
     session = Session(config)
     envs = session.venvlist
     assert len(envs) == 2
     env1, env2 = envs
     env1.status = "FAIL XYZ"
     assert env1.status
     env2.status = 0
     assert not env2.status
     session._summary()
     out, err = capfd.readouterr()
     exp = "{}: FAIL XYZ".format(env1.envconfig.envname)
     assert exp in out
     exp = "{}: commands succeeded".format(env2.envconfig.envname)
     assert exp in out
Esempio n. 4
0
 def test_summary_status(self, initproj, capfd):
     initproj("logexample123-0.5",
              filedefs={
                  'tests': {
                      'test_hello.py': "def test_hello(): pass"
                  },
                  'tox.ini':
                  '''
         [testenv:hello]
         [testenv:world]
         '''
              })
     config = parseconfig([])
     session = Session(config)
     envs = session.venvlist
     assert len(envs) == 2
     env1, env2 = envs
     env1.status = "FAIL XYZ"
     assert env1.status
     env2.status = 0
     assert not env2.status
     session._summary()
     out, err = capfd.readouterr()
     exp = "%s: FAIL XYZ" % env1.envconfig.envname
     assert exp in out
     exp = "%s: commands succeeded" % env2.envconfig.envname
     assert exp in out
Esempio n. 5
0
 def parse_toxini(self):
     """parse the tox ini, return dict of environments to list of commands"""
     logger.debug('Calling tox.config.parseconfig()')
     config = parseconfig(args=[])
     logger.debug('Config parsed; envlist: %s', config.envlist)
     env_config = {}
     for envname in config.envlist:
         bindir = os.path.join(config.envconfigs[envname].envdir.strpath,
                               'bin')
         env_config[envname] = {
             'commands': [],
             'passenv': [x for x in config.envconfigs[envname].passenv],
             'setenv': {
                 a: config.envconfigs[envname].setenv.get(a)
                 for a in config.envconfigs[envname].setenv.keys()
             }
         }
         for cmd in config.envconfigs[envname].commands:
             if cmd in self.ignore_commands:
                 logger.debug('%s - skipping ignored command: %s', envname,
                              cmd)
                 continue
             cmd[0] = os.path.join(bindir, cmd[0])
             env_config[envname]['commands'].append(cmd)
         logger.debug('env %s: %s', envname, env_config[envname])
     return env_config
Esempio n. 6
0
 def parse_toxini(self):
     """parse the tox ini, return dict of environments to list of commands"""
     logger.debug('Calling tox.config.parseconfig()')
     config = parseconfig(args=[])
     logger.debug('Config parsed; envlist: %s', config.envlist)
     env_config = {}
     for envname in config.envlist:
         bindir = os.path.join(
             config.envconfigs[envname].envdir.strpath,
             'bin'
         )
         env_config[envname] = {
             'commands': [],
             'passenv': [x for x in config.envconfigs[envname].passenv],
             'setenv': {
                 a: config.envconfigs[envname].setenv.get(a) for a in
                 config.envconfigs[envname].setenv.keys()
             }
         }
         for cmd in config.envconfigs[envname].commands:
             if cmd in self.ignore_commands:
                 logger.debug('%s - skipping ignored command: %s',
                              envname, cmd)
                 continue
             cmd[0] = os.path.join(bindir, cmd[0])
             env_config[envname]['commands'].append(cmd)
         logger.debug('env %s: %s', envname, env_config[envname])
     return env_config
Esempio n. 7
0
def test_make_sdist_distshare(tmpdir, initproj):
    distshare = tmpdir.join("distshare")
    initproj(
        "example123-0.6",
        filedefs={
            "tests": {"test_hello.py": "def test_hello(): pass"},
            "tox.ini": """
        [tox]
        distshare={}
        """.format(
                distshare
            ),
        },
    )
    config = parseconfig([])
    session = Session(config)
    package, dist = get_package(session)
    assert package.check()
    assert package.ext == ".zip"
    assert package == config.temp_dir.join("package", "1", package.basename)

    assert dist == config.distdir.join(package.basename)
    assert dist.check()
    assert os.stat(str(dist)).st_ino == os.stat(str(package)).st_ino

    sdist_share = config.distshare.join(package.basename)
    assert sdist_share.check()
    assert sdist_share.read("rb") == dist.read("rb"), (sdist_share, package)
Esempio n. 8
0
def prepare(args):
    config = parseconfig(args)
    if config.option.help:
        show_help(config)
        raise SystemExit(0)
    elif config.option.helpini:
        show_help_ini(config)
        raise SystemExit(0)
    return config
Esempio n. 9
0
def prepare(args):
    config = parseconfig(args)
    if config.option.help:
        show_help(config)
        raise SystemExit(0)
    elif config.option.helpini:
        show_help_ini(config)
        raise SystemExit(0)
    return config
Esempio n. 10
0
 def create_new_config_file_(args, source=None, plugins=()):
     if source is None:
         source = args
         args = []
     s = textwrap.dedent(source)
     p = tmpdir.join("tox.ini")
     p.write(s)
     with tmpdir.as_cwd():
         return parseconfig(args, plugins=plugins)
Esempio n. 11
0
 def create_new_config_file_(args, source=None, plugins=(), filename="tox.ini"):
     if source is None:
         source = args
         args = []
     s = textwrap.dedent(source)
     p = tmpdir.join(filename)
     p.write(s)
     tox.session.setup_reporter(args)
     with tmpdir.as_cwd():
         return parseconfig(args, plugins=plugins)
Esempio n. 12
0
def test_all_rst_ini_blocks_parse(filename, tmpdir):
    with open(filename) as f:
        contents = f.read()
    for match in INI_BLOCK_RE.finditer(contents):
        code = textwrap.dedent(match.group("code"))
        f = tmpdir.join("tox.ini")
        f.write(code)
        try:
            parseconfig(("-c", str(f)))
        except Exception as e:
            raise AssertionError(
                "Error parsing ini block\n\n"
                "{filename}:{lineno}\n\n"
                "{code}\n\n"
                "{error}\n\n{error!r}".format(
                    filename=filename,
                    lineno=contents[:match.start()].count("\n") + 1,
                    code="\t" + code.replace("\n", "\n\t").strip(),
                    error=e,
                ))
Esempio n. 13
0
def load_config(args):
    try:
        config = parseconfig(args)
        if config.option.help:
            show_help(config)
            raise SystemExit(0)
        elif config.option.helpini:
            show_help_ini(config)
            raise SystemExit(0)
    except tox.exception.MissingRequirement as exception:
        config = exception.config
    return config
Esempio n. 14
0
def test_all_rst_ini_blocks_parse(filename, tmpdir):
    with open(filename) as f:
        contents = f.read()
    for match in INI_BLOCK_RE.finditer(contents):
        code = textwrap.dedent(match.group("code"))
        config_path = tmpdir / "tox.ini"
        config_path.write(code)
        try:
            parseconfig(["-c", str(config_path)])
        except tox.exception.MissingRequirement:
            assert "requires = tox-venv" in str(code)
        except Exception as e:
            raise AssertionError(
                "Error parsing ini block\n\n"
                "{filename}:{lineno}\n\n"
                "{code}\n\n"
                "{error}\n\n{error!r}".format(
                    filename=filename,
                    lineno=contents[:match.start()].count("\n") + 1,
                    code="\t" + code.replace("\n", "\n\t").strip(),
                    error=e,
                ))
Esempio n. 15
0
def generate_tox_config(fileobj):

    def print_(text):
        print(text, file=fileobj)

    print_('language: python')
    print_('python: 3.5')
    print_('env:')
    for env in parseconfig().envlist:
        print_('  - TOX_ENV={env}'.format(env=env))
    print_('install:')
    print_('  - pip install tox')
    print_('script:')
    print_('  - tox -e $TOX_ENV')
Esempio n. 16
0
 def test_getvenv(self, initproj, capfd):
     initproj("logexample123-0.5", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         [testenv:hello]
         [testenv:world]
         '''
     })
     config = parseconfig([])
     session = Session(config)
     venv1 = session.getvenv("hello")
     venv2 = session.getvenv("hello")
     assert venv1 is venv2
     venv1 = session.getvenv("world")
     venv2 = session.getvenv("world")
     assert venv1 is venv2
     pytest.raises(LookupError, lambda: session.getvenv("qwe"))
Esempio n. 17
0
 def test_getvenv(self, initproj, capfd):
     initproj("logexample123-0.5", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         [testenv:hello]
         [testenv:world]
         '''
     })
     config = parseconfig([])
     session = Session(config)
     venv1 = session.getvenv("hello")
     venv2 = session.getvenv("hello")
     assert venv1 is venv2
     venv1 = session.getvenv("world")
     venv2 = session.getvenv("world")
     assert venv1 is venv2
     pytest.raises(LookupError, lambda: session.getvenv("qwe"))
Esempio n. 18
0
    def start_processes(self, reason):
        self.reason = reason
        try:
            tox_config = parseconfig(['-c', self.path])
        except Exception:
            return

        self.kill_processes()

        self.tox_waiting_envs = [x for x in sorted(tox_config.envconfigs)
                                 if (len(self.envs) == 0 or x in self.envs) and
                                 x not in self.omit_envs]
        for env in self.tox_waiting_envs:
            self.tox_procs[env] = None
        self.start_next_process()

        self.update_status()
Esempio n. 19
0
 def test_make_sdist_distshare(self, tmpdir, initproj):
     distshare = tmpdir.join("distshare")
     initproj("example123-0.6", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         [tox]
         distshare=%s
         ''' % distshare
     })
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist_share = config.distshare.join(sdist.basename)
     assert sdist_share.check()
     assert sdist_share.read("rb") == sdist.read("rb"), (sdist_share, sdist)
Esempio n. 20
0
 def test_make_sdist_distshare(self, tmpdir, initproj):
     distshare = tmpdir.join("distshare")
     initproj("example123-0.6", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         [tox]
         distshare=%s
         ''' % distshare
     })
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist_share = config.distshare.join(sdist.basename)
     assert sdist_share.check()
     assert sdist_share.read("rb") == sdist.read("rb"), (sdist_share, sdist)
Esempio n. 21
0
 def test_make_sdist(self, initproj):
     initproj("example123-0.5", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         '''
     })
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist2 = session.get_installpkg_path()
     assert sdist2 == sdist
     sdist.write("hello")
     assert sdist.stat().size < 10
     sdist_new = Session(config).get_installpkg_path()
     assert sdist_new == sdist
     assert sdist_new.stat().size > 10
Esempio n. 22
0
 def test_make_sdist(self, initproj):
     initproj("example123-0.5", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         '''
     })
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist2 = session.get_installpkg_path()
     assert sdist2 == sdist
     sdist.write("hello")
     assert sdist.stat().size < 10
     sdist_new = Session(config).get_installpkg_path()
     assert sdist_new == sdist
     assert sdist_new.stat().size > 10
Esempio n. 23
0
def test_install_special_deps(toxconfig, mocker, actioncls, tmpdir):
    """
    Test that nothing is called when there are no deps
    """
    action = actioncls()
    p = tmpdir.join("tox.ini")
    p.write(toxconfig)
    with tmpdir.as_cwd():
        config = parseconfig([])

        for env, envconfig in config.envconfigs.items():
            session = Session(config)
            venv = tox.venv.VirtualEnv(envconfig, session=session)
            mocker.patch("subprocess.Popen")
            result = session.runtestenv(venv)
            assert result == True
            assert subprocess.Popen.call_count == 1
            call_list = [sys.executable, "-m", "pipenv", "install", "--dev"]
            call_list.extend([package for package in venv._getresolvedeps()])
            assert subprocess.Popen.call_args_list[0][0] == (call_list,)
Esempio n. 24
0
 def test_getvenv(self, initproj):
     initproj(
         "logexample123-0.5",
         filedefs={
             "tests": {"test_hello.py": "def test_hello(): pass"},
             "tox.ini": """
         [testenv:hello]
         [testenv:world]
         """,
         },
     )
     config = parseconfig([])
     session = Session(config)
     venv1 = session.getvenv("hello")
     venv2 = session.getvenv("hello")
     assert venv1 is venv2
     venv1 = session.getvenv("world")
     venv2 = session.getvenv("world")
     assert venv1 is venv2
     with pytest.raises(LookupError):
         session.getvenv("qwe")
Esempio n. 25
0
 def test_make_sdist_distshare(self, tmpdir, initproj):
     distshare = tmpdir.join("distshare")
     initproj(
         "example123-0.6",
         filedefs={
             "tests": {"test_hello.py": "def test_hello(): pass"},
             "tox.ini": """
         [tox]
         distshare={}
         """.format(
                 distshare
             ),
         },
     )
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist_share = config.distshare.join(sdist.basename)
     assert sdist_share.check()
     assert sdist_share.read("rb") == sdist.read("rb"), (sdist_share, sdist)
Esempio n. 26
0
    def run_tests(self):
        fails = []
        from tox.config import parseconfig
        from tox.session import Session

        config = parseconfig(self.test_args)
        retcode = Session(config).runcommand()
        if retcode != 0:
            fails.append('tox returned errors')

        import pep8
        style_guide = pep8.StyleGuide(config_file=BASE_PATH + '/.pep8')
        style_guide.input_dir(BASE_PATH + '/libimg')
        if style_guide.options.report.get_count() != 0:
            fails.append('pep8 returned errros for libimg/')

        style_guide = pep8.StyleGuide(config_file=BASE_PATH + '/.pep8')
        style_guide.input_dir(BASE_PATH + '/test')
        if style_guide.options.report.get_count() != 0:
            fails.append('pep8 returned errros for libimg/')

        if fails:
            print('\n'.join(fails))
            sys.exit(1)
Esempio n. 27
0
def test_make_sdist(initproj):
    initproj(
        "example123-0.5",
        filedefs={
            "tests": {
                "test_hello.py": "def test_hello(): pass"
            },
            "tox.ini": """
        """,
        },
    )
    config = parseconfig([])
    session = Session(config)
    _, sdist = get_package(session)
    assert sdist.check()
    assert sdist.ext == ".zip"
    assert sdist == config.distdir.join(sdist.basename)
    _, sdist2 = get_package(session)
    assert sdist2 == sdist
    sdist.write("hello")
    assert sdist.stat().size < 10
    _, sdist_new = get_package(Session(config))
    assert sdist_new == sdist
    assert sdist_new.stat().size > 10
Esempio n. 28
0
    def run_tests(self):
        fails = []
        from tox.config import parseconfig
        from tox.session import Session

        config = parseconfig(self.test_args)
        retcode = Session(config).runcommand()
        if retcode != 0:
            fails.append('tox returned errors')

        import pep8
        style_guide = pep8.StyleGuide(config_file=BASE_PATH + '/.pep8')
        style_guide.input_dir(BASE_PATH + '/rw')
        if style_guide.options.report.get_count() != 0:
            fails.append('pep8 returned errros for rw/')

        style_guide = pep8.StyleGuide(config_file=BASE_PATH + '/.pep8')
        style_guide.input_dir(BASE_PATH + '/test')
        if style_guide.options.report.get_count() != 0:
            fails.append('pep8 returned errros for test/')

        if fails:
            print('\n'.join(fails))
            sys.exit(1)
Esempio n. 29
0
    def _collect(self):

        if not (self.path / "tox.ini").exists():
            return

        try:
            toxconf = parseconfig([])
        except ConfigError as exc:
            self._warn_exc(exc)
            return

        python = "python%d.%d" % (sys.version_info.major, sys.version_info.minor)
        configs = sorted(
            filter(
                lambda c: not self.ENV_IGNORE_PATTERN.match(c.envname),
                toxconf.envconfigs.values(),
            ),
            key=lambda c: c.envname,
            reverse=True,
        )
        match_configs = [c for c in configs
                         if Path(c.basepython).name in (python, python + "m")]
        if match_configs:
            envname = "py%d%d" % (sys.version_info.major, sys.version_info.minor)
            for config in match_configs:
                if config.envname == envname:
                    break
            else:
                for config in match_configs:
                    if config.envname.startswith("py"):
                        break
                else:
                    config = match_configs[0]
        else:
            if not configs:
                log.warning("%r no config found", self)
                return
            config = configs[0]
            log.warning("%r has no config for %s, using %s", self, python, config.envname)

        # dependencies
        for dep in config.deps:
            if dep.name.startswith("-r"):
                reqs_file = dep.name[2:].strip()
                if not (self.path / reqs_file).exists():
                    log.warning(
                        "%r %r from tox.ini does not exist",
                        self,
                        reqs_file,
                    )
                    continue
                self.add_requirements_file(reqs_file, "test")
            else:
                self.add_requirement(dep.name, "test")

        # environment
        env = Munch()
        for key in config.setenv.keys():
            if key != "PYTHONHASHSEED":
                env[key] = self._detox(config, config.setenv[key])

        # commands
        commands = [[self._detox(config, c) for c in cmd] for cmd in config.commands]

        self.ext.tox = Munch(commands=commands, env=env)
Esempio n. 30
0
#!/usr/bin/env python
# flake8: noqa

import sys
import os
import os.path
from tox.config import parseconfig

# This file is in pyCraft/bin/; it needs to execute in pyCraft/.
os.chdir(os.path.join(os.path.dirname(__file__), ".."))

print("language: python")
print("python: 3.5")
print("env:")
for env in parseconfig(None, "tox").envlist:
    print("  - TOX_ENV=%s" % env)
print("install:")
print("  - pip install tox")
print("  - pip install python-coveralls")
print("script:")
print("  - tox -e $TOX_ENV")
print("after_script:")
print('  - if [ "$TOX_ENV" = "py35" ]; then tox -e coveralls; fi')
print("notifications:")
print("  email: false")
            return None
        return [bin, os.path.join(helpers_dir, "pytestrunner.py"), "-p", "pytest_teamcity"] + command[1:]


class _Nose(object):
    def fix(self, command, bin):
        if command[0] != "nosetests":
            return None
        return [bin, os.path.join(helpers_dir, "noserunner.py")] + command[1:]


_RUNNERS = [_Unit2(), _PyTest(), _Nose()]

import sys

config = tox_config.parseconfig(args=sys.argv[1:])
config.pluginmanager.register(JbToxHook(config), "jbtoxplugin")
for env, tmp_config in config.envconfigs.items():
    if not tmp_config.setenv:
        tmp_config.setenv = dict()
    tmp_config.setenv["_jb_do_not_call_enter_matrix"] = "1"
    commands = tmp_config.commands
    if not isinstance(commands, list) or not len(commands):
        continue
    for fixer in _RUNNERS:
        _env = config.envconfigs[env]
        for i, command in enumerate(commands):
            if command:
                fixed_command = fixer.fix(command, str(_env.envpython))
                if fixed_command:
                    commands[i] = fixed_command
Esempio n. 32
0
from tox.config import parseconfig
import os
file = open(".travis.yml", "w")
base_python = {
    "py36": "3.6",
    "py37": "3.7",
    "py38": "3.8-dev",
    "lint": "3.7",
    "read": "3.7",
}
env_configs = parseconfig(None, 'tox').envconfigs

file.write("dist: xenial" + "\r")
file.write("language: python" + "\r")
file.write("matrix:" + "\r")
file.write("  include:" + "\r")
for env in env_configs:
    file.write("    - python: %s" % base_python[env[0:4]] + "\r")
    file.write("      env: TOX_ENV=%s" % env + "\r")
file.write("install:" + "\r")
file.write(" - pip install tox" + "\r")
file.write("script:" + "\r")
file.write(" - tox -e $TOX_ENV" + "\r")
file.close()


Esempio n. 33
0
 def test_normal(self, newconfig):
     newconfig("")
     print(os.getcwd())
     config = parseconfig([])
     assert not config.option.direct
     assert not config.option.direct_yolo
Esempio n. 34
0
 def test_direct_yolo(self, newconfig):
     newconfig("")
     config = parseconfig(["--direct-yolo"])
     assert not config.option.direct
     assert config.option.direct_yolo
Esempio n. 35
0
            os.path.join(helpers_dir, "pytestrunner.py"), "-p",
            "pytest_teamcity"
        ] + command[1:]


class _Nose(object):
    def fix(self, command, bin):
        if command[0] != "nosetests":
            return None
        return [bin, os.path.join(helpers_dir, "noserunner.py")] + command[1:]


_RUNNERS = [_Unit2(), _PyTest(), _Nose()]

import sys
config = tox_config.parseconfig(args=sys.argv[1:])
for env, tmp_config in config.envconfigs.items():
    if not tmp_config.setenv:
        tmp_config.setenv = dict()
    tmp_config.setenv["_jb_do_not_call_enter_matrix"] = "1"
    commands = tmp_config.commands
    if not isinstance(commands, list) or not len(commands):
        continue
    for fixer in _RUNNERS:
        _env = config.envconfigs[env]
        for i, command in enumerate(commands):
            if command:
                fixed_command = fixer.fix(command, str(_env.envpython))
                if fixed_command:
                    commands[i] = fixed_command
    tmp_config.commands = commands
Esempio n. 36
0
#!/usr/bin/env python
# flake8: noqa

import sys
import os
import os.path
from tox.config import parseconfig

# This file is in pyCraft/bin/; it needs to execute in pyCraft/.
os.chdir(os.path.join(os.path.dirname(__file__), ".."))

print("language: python")
print("python: 3.5")
print("env:")
for env in parseconfig(None, 'tox').envlist:
    print("  - TOX_ENV=%s" % env)
print("install:")
print("  - pip install tox")
print("  - pip install python-coveralls")
print("script:")
print("  - tox -e $TOX_ENV")
print("after_script:")
print('  - if [ "$TOX_ENV" = "py35" ]; then tox -e coveralls; fi')
print("notifications:")
print("  email: false")
Esempio n. 37
0
            if name != teamcity.topmost_suite:
                teamcity.testFailed(name, msg)
            else:
                teamcity.testFailed("ERROR", msg)
                teamcity.testSuiteFinished(name)
        else:
            sys.stderr.write(msg)

    def skip(self, msg):
        super(_Reporter, self).skip(msg)
        name = teamcity.current_test_name()
        if name:
            teamcity.testFinished(name)


config = tox_config.parseconfig()
for env, tmp_config in config.envconfigs.items():
    if not tmp_config.setenv:
        tmp_config.setenv = dict()
    tmp_config.setenv["_jb_do_not_call_enter_matrix"] = "1"
    commands = tmp_config.commands
    if not isinstance(commands, list) or not len(commands):
        continue
    for fixer in _RUNNERS:
        _env = config.envconfigs[env]
        dir_to_run = str(_env.changedir)
        for i, command in enumerate(commands):
            fixed_command = fixer.fix(command, dir_to_run, str(_env.envpython))
            if fixed_command:
                commands[i] = fixed_command
    tmp_config.commands = commands
            if name != teamcity.topmost_suite:
                teamcity.testFailed(name, msg)
            else:
                teamcity.testFailed("ERROR", msg)
                teamcity.testSuiteFinished(name)
        else:
            sys.stderr.write(msg)

    def skip(self, msg):
        super(_Reporter, self).skip(msg)
        name = teamcity.current_test_name()
        if name:
            teamcity.testFinished(name)


config = tox_config.parseconfig()
for env, tmp_config in config.envconfigs.items():
    if not tmp_config.setenv:
        tmp_config.setenv = dict()
    tmp_config.setenv["_jb_do_not_call_enter_matrix"] = "1"
    commands = tmp_config.commands
    if not isinstance(commands, list) or not len(commands):
        continue
    for fixer in _RUNNERS:
        _env = config.envconfigs[env]
        dir_to_run = str(_env.changedir)
        for i, command in enumerate(commands):
            fixed_command = fixer.fix(command, dir_to_run, str(_env.envpython))
            if fixed_command:
                commands[i] = fixed_command
    tmp_config.commands = commands