Skip to content

Commit

Permalink
Simplify logic to determine logging level
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysle committed Sep 6, 2023
1 parent baaa574 commit 895cf0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions src/pipx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,16 +816,7 @@ def setup_logging(verbose: bool) -> None:
pipx.constants.pipx_log_file = setup_log_file()

# Determine logging level
if verbose >= 1:
level_number = logging.DEBUG
elif verbose == -1:
level_number = logging.WARNING
elif verbose == -2:
level_number = logging.ERROR
elif verbose <= -3:
level_number = logging.CRITICAL
else:
level_number = logging.INFO
level_number = max(0, 2 - verbose) * 10

level = logging.getLevelName(level_number)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def test_include_deps(pipx_temp_env, capsys):
@pytest.mark.parametrize(
"package_name, package_spec",
[
("tox-ini-fmt", PKG["tox-ini-fmt"]["spec"]),
("zest-releaser", PKG["zest-releaser"]["spec"]),
("tox-ini-fmt", PKG["tox-ini-fmt"]["spec"]),
],
)
def test_name_tricky_characters(
Expand Down

0 comments on commit 895cf0a

Please sign in to comment.