Skip to content

Commit 8a9d169

Browse files
committed
Add ABCMeta to Distribution. Fixes #419.
1 parent 1bf8a7a commit 8a9d169

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Diff for: importlib_metadata/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def __repr__(self):
346346
return f'<FileHash mode: {self.mode} value: {self.value}>'
347347

348348

349-
class Distribution:
349+
class Distribution(metaclass=abc.ABCMeta):
350350
"""A Python distribution package."""
351351

352352
@abc.abstractmethod

Diff for: tests/test_main.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ def test_package_not_found_mentions_metadata(self):
4444
assert "metadata" in str(ctx.exception)
4545

4646
def test_abc_enforced(self):
47-
with self.assertRaises(AssertionError): # xfail
48-
with self.assertRaises(TypeError):
49-
type('DistributionSubclass', (Distribution,), {})()
47+
with self.assertRaises(TypeError):
48+
type('DistributionSubclass', (Distribution,), {})()
5049

5150
@fixtures.parameterize(
5251
dict(name=None),

0 commit comments

Comments
 (0)