Skip to content

Commit 98ea245

Browse files
committed
pylock: remove unused attribute
1 parent 73f0c6a commit 98ea245

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/pip/_internal/models/pylock.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ class PylockValidationError(Exception):
209209
class PylockRequiredKeyError(PylockValidationError):
210210
def __init__(self, key: str) -> None:
211211
super().__init__(f"Missing required key {key!r}")
212-
self.key = key
213212

214213

215214
class PylockUnsupportedVersionError(PylockValidationError):

tests/unit/test_pylock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_pylock_missing_version() -> None:
7575
}
7676
with pytest.raises(PylockRequiredKeyError) as exc_info:
7777
Pylock.from_dict(data)
78-
assert exc_info.value.key == "lock-version"
78+
assert str(exc_info.value) == "Missing required key 'lock-version'"
7979

8080

8181
def test_pylock_missing_created_by() -> None:
@@ -85,7 +85,7 @@ def test_pylock_missing_created_by() -> None:
8585
}
8686
with pytest.raises(PylockRequiredKeyError) as exc_info:
8787
Pylock.from_dict(data)
88-
assert exc_info.value.key == "created-by"
88+
assert str(exc_info.value) == "Missing required key 'created-by'"
8989

9090

9191
def test_pylock_missing_packages() -> None:
@@ -95,7 +95,7 @@ def test_pylock_missing_packages() -> None:
9595
}
9696
with pytest.raises(PylockRequiredKeyError) as exc_info:
9797
Pylock.from_dict(data)
98-
assert exc_info.value.key == "packages"
98+
assert str(exc_info.value) == "Missing required key 'packages'"
9999

100100

101101
def test_pylock_packages_without_dist() -> None:

0 commit comments

Comments
 (0)