Skip to content

Commit

Permalink
Print pip install output if verbosity is higher than default
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Oct 28, 2020
1 parent 45f5bb0 commit 5eed0f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/tox/config/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def _get_help_string(self, action: Action) -> Optional[str]:


ToxParserT = TypeVar("ToxParserT", bound="ToxParser")
DEFAULT_VERBOSITY = 2


class Parsed(Namespace):
Expand Down Expand Up @@ -159,7 +160,9 @@ def _add_base_options(self) -> None:
f"verbosity=verbose-quiet, default {logging.getLevelName(LEVELS[3])}, map {level_map}",
)
verbosity = verbosity_group.add_mutually_exclusive_group()
verbosity.add_argument("-v", "--verbose", action="count", dest="verbose", help="increase verbosity", default=2)
verbosity.add_argument(
"-v", "--verbose", action="count", dest="verbose", help="increase verbosity", default=DEFAULT_VERBOSITY
)
verbosity.add_argument("-q", "--quiet", action="count", dest="quiet", help="decrease verbosity", default=0)

converter = StrConvert()
Expand Down Expand Up @@ -224,3 +227,10 @@ def _inject_default_cmd(self, args: Sequence[str]) -> Sequence[str]:
new_args.extend(command_args)
new_args.extend(args[reorganize_to + 1 :])
return new_args


__all__ = (
"DEFAULT_VERBOSITY",
"Parsed",
"ToxParser",
)
9 changes: 7 additions & 2 deletions src/tox/tox_env/python/virtual_env/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from virtualenv.create.creator import Creator
from virtualenv.run.session import Session

from tox.config.cli.parser import Parsed
from tox.config.cli.parser import DEFAULT_VERBOSITY, Parsed
from tox.config.sets import ConfigSet
from tox.execute.api import Execute, Outcome
from tox.execute.local_sub_process import LocalSubProcessExecutor
Expand Down Expand Up @@ -98,4 +98,9 @@ def install_python_packages(
result.assert_success(self.logger)

def perform_install(self, install_command: Sequence[str]) -> Outcome:
return self.execute(cmd=install_command, allow_stdin=False, run_id="install")
return self.execute(
cmd=install_command,
allow_stdin=False,
run_id="install",
show_on_standard=self.options.verbosity > DEFAULT_VERBOSITY,
)
Empty file.

0 comments on commit 5eed0f5

Please sign in to comment.