Skip to content

Commit b614481

Browse files
authored
Handle InvalidWheel for metadata backfill (#15450)
1 parent e50010a commit b614481

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/unit/packaging/test_tasks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import pytest
2323

2424
from google.cloud.bigquery import SchemaField
25-
from pip._internal.exceptions import UnsupportedWheel
25+
from pip._internal.exceptions import InvalidWheel, UnsupportedWheel
2626
from wtforms import Field, Form, StringField
2727

2828
import warehouse.packaging.tasks
@@ -1029,7 +1029,9 @@ def mock_open(filename, perms):
10291029
]
10301030

10311031

1032-
@pytest.mark.parametrize("exception", [UnsupportedWheel, BadZipFile])
1032+
@pytest.mark.parametrize(
1033+
"exception", [InvalidWheel("foo", "bar"), UnsupportedWheel, BadZipFile]
1034+
)
10331035
def test_metadata_backfill_file_invalid_wheel(
10341036
db_request, monkeypatch, metrics, exception
10351037
):

warehouse/packaging/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from zipfile import BadZipFile
2323

2424
from google.cloud.bigquery import LoadJobConfig
25-
from pip._internal.exceptions import UnsupportedWheel
25+
from pip._internal.exceptions import InvalidWheel, UnsupportedWheel
2626
from pip._internal.network.lazy_wheel import dist_from_wheel_url
2727
from pip._internal.network.session import PipSession
2828
from sqlalchemy import desc
@@ -107,7 +107,7 @@ def metadata_backfill_individual(request, file_id):
107107
file_.release.project.normalized_name, file_url, session
108108
)
109109
wheel_metadata_contents = lazy_dist._dist._files[Path("METADATA")]
110-
except (UnsupportedWheel, BadZipFile):
110+
except (InvalidWheel, UnsupportedWheel, BadZipFile):
111111
file_.metadata_file_unbackfillable = True
112112
return
113113

0 commit comments

Comments
 (0)