Пример #1
0
 def report_env(e):
     if description:
         text = env_conf[e].description or "[no description]"
         msg = "{} -> {}".format(e.ljust(max_length), text).strip()
     else:
         msg = e
     report.line(msg)
Пример #2
0
 def run_system_cmd(cmd):
     """Helper to report running command and also to actually run the command"""
     reporter.line("external_build: running command: {}".format(cmd))
     p_cmd = Popen(cmd, shell=True, stderr=STDOUT)
     stdout, _ = p_cmd.communicate()
     if p_cmd.returncode != 0:
         reporter.error(
             "external_build returned: {} stdout+stderr: {}".format(
                 p_cmd.returncode, stdout))
         raise ExternalBuildNonZeroReturn(
             "'{}' exited with return code: {}".format(
                 cmd, p_cmd.returncode))
Пример #3
0
 def _summary(self):
     is_parallel_child = PARALLEL_ENV_VAR_KEY_PRIVATE in os.environ
     if not is_parallel_child:
         reporter.separator("_", "summary", reporter.Verbosity.QUIET)
     exit_code = 0
     for venv in self.venv_dict.values():
         report = reporter.good
         status = getattr(venv, "status", "undefined")
         if isinstance(status, tox.exception.InterpreterNotFound):
             msg = " {}: {}".format(venv.envconfig.envname, str(status))
             if self.config.option.skip_missing_interpreters == "true":
                 report = reporter.skip
             else:
                 exit_code = 1
                 report = reporter.error
         elif status == "platform mismatch":
             msg = " {}: {} ({!r} does not match {!r})".format(
                 venv.envconfig.envname,
                 str(status),
                 sys.platform,
                 venv.envconfig.platform,
             )
             report = reporter.skip
         elif status and status == "ignored failed command":
             msg = "  {}: {}".format(venv.envconfig.envname, str(status))
         elif status and status != "skipped tests":
             msg = "  {}: {}".format(venv.envconfig.envname, str(status))
             report = reporter.error
             exit_code = 1
         else:
             if not status:
                 status = "commands succeeded"
             msg = "  {}: {}".format(venv.envconfig.envname, status)
         if not is_parallel_child:
             report(msg)
     if not exit_code and not is_parallel_child:
         reporter.good("  congratulations :)")
     path = self.config.option.resultjson
     if path:
         if not is_parallel_child:
             self._add_parallel_summaries()
         path = py.path.local(path)
         data = self.resultlog.dumps_json()
         reporter.line("write json report at: {}".format(path))
         path.write(data)
     return exit_code
Пример #4
0
def show_envs(config, all_envs=False, description=False):
    env_conf = config.envconfigs  # this contains all environments
    default = config.envlist  # this only the defaults
    ignore = {config.isolated_build_env, config.provision_tox_env}.union(default)
    extra = [e for e in env_conf if e not in ignore] if all_envs else []

    if description:
        report.line("default environments:")
        max_length = max(len(env) for env in (default + extra))

    def report_env(e):
        if description:
            text = env_conf[e].description or "[no description]"
            msg = "{} -> {}".format(e.ljust(max_length), text).strip()
        else:
            msg = e
        report.line(msg)

    for e in default:
        report_env(e)
    if all_envs and extra:
        if description:
            report.line("")
            report.line("additional environments:")
        for e in extra:
            report_env(e)
Пример #5
0
def show_help_ini(config):
    reporter.separator("-", "per-testenv attributes", reporter.Verbosity.INFO)
    for env_attr in config._testenv_attr:
        reporter.line(
            "{:<15} {:<8} default: {}".format(env_attr.name,
                                              "<{}>".format(env_attr.type),
                                              env_attr.default),
            bold=True,
        )
        reporter.line(env_attr.help)
        reporter.line("")
Пример #6
0
def show_config(config):
    info_versions()
    report.keyvalue("config-file:", config.option.configfile)
    report.keyvalue("toxinipath: ", config.toxinipath)
    report.keyvalue("toxinidir:  ", config.toxinidir)
    report.keyvalue("toxworkdir: ", config.toxworkdir)
    report.keyvalue("setupdir:   ", config.setupdir)
    report.keyvalue("distshare:  ", config.distshare)
    report.keyvalue("skipsdist:  ", config.skipsdist)
    report.line("")
    for envconfig in config.envconfigs.values():
        report.line("[testenv:{}]".format(envconfig.envname), bold=True)
        for attr in config._parser._testenv_attr:
            report.line("  {:<15} = {}".format(attr.name,
                                               getattr(envconfig, attr.name)))
Пример #7
0
def show_help(config):
    reporter.line(config._parser._format_help())
    reporter.line("Environment variables", bold=True)
    reporter.line(
        "TOXENV: comma separated list of environments (overridable by '-e')")
    reporter.line(
        "TOX_SKIP_ENV: regular expression to filter down from running tox environments"
    )
    reporter.line(
        "TOX_TESTENV_PASSENV: space-separated list of extra environment variables to be "
        "passed into test command environments")
    reporter.line("PY_COLORS: 0 disable colorized output, 1 enable (default)")
    reporter.line(
        "TOX_PARALLEL_NO_SPINNER: 1 disable spinner for CI, 0 enable (default)"
    )