Skip to content

Commit

Permalink
typing updates (python-poetry#8541)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored Oct 15, 2023
1 parent 3002a04 commit 8b4efb1
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 52 deletions.
79 changes: 34 additions & 45 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pytest-randomly = "^3.12"
pytest-xdist = { version = "^3.1", extras = ["psutil"] }

[tool.poetry.group.typing.dependencies]
mypy = ">=1.0"
mypy = ">=1.6.0"
types-requests = ">=2.28.8"

# only used in github actions
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/installation/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from build import ProjectBuilder
from build.env import IsolatedEnv as BaseIsolatedEnv
from poetry.core.utils.helpers import temporary_directory
from pyproject_hooks import quiet_subprocess_runner # type: ignore[import]
from pyproject_hooks import quiet_subprocess_runner # type: ignore[import-untyped]

from poetry.utils._compat import decode
from poetry.utils.env import ephemeral_environment
Expand Down
13 changes: 8 additions & 5 deletions src/poetry/publishing/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@
class UploadError(Exception):
def __init__(self, error: ConnectionError | HTTPError | str) -> None:
if isinstance(error, HTTPError):
message = (
f"HTTP Error {error.response.status_code}: {error.response.reason} |"
f" {error.response.content!r}"
)
if error.response is None:
message = "HTTP Error connecting to the repository"
else:
message = (
f"HTTP Error {error.response.status_code}: "
f"{error.response.reason} | {error.response.content!r}"
)
elif isinstance(error, ConnectionError):
message = (
"Connection Error: We were unable to connect to the repository, "
"ensure the url is correct and can be reached."
)
else:
message = str(error)
message = error
super().__init__(message)


Expand Down
1 change: 1 addition & 0 deletions tests/utils/test_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ def callback(
with pytest.raises(requests.exceptions.HTTPError) as excinfo:
authenticator.request("get", sdist_uri)

assert excinfo.value.response is not None
assert excinfo.value.response.status_code == status
assert excinfo.value.response.text == content

Expand Down

0 comments on commit 8b4efb1

Please sign in to comment.