File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -548,15 +548,18 @@ def locate_file(self, path):
548
548
"""
549
549
550
550
@classmethod
551
- def from_name (cls , name ):
551
+ def from_name (cls , name : str ):
552
552
"""Return the Distribution for the given package name.
553
553
554
554
:param name: The name of the distribution package to search for.
555
555
:return: The Distribution instance (or subclass thereof) for the named
556
556
package, if found.
557
557
:raises PackageNotFoundError: When the named package's distribution
558
558
metadata cannot be found.
559
+ :raises ValueError: When an invalid value is supplied for name.
559
560
"""
561
+ if not name :
562
+ raise ValueError ("A distribution name is required." )
560
563
for resolver in cls ._discover_resolvers ():
561
564
dists = resolver (DistributionFinder .Context (name = name ))
562
565
dist = next (iter (dists ), None )
Original file line number Diff line number Diff line change 1
1
import re
2
2
import json
3
3
import pickle
4
- import pytest
5
4
import unittest
6
5
import warnings
7
6
import importlib
@@ -51,7 +50,6 @@ def test_new_style_classes(self):
51
50
self .assertIsInstance (Distribution , type )
52
51
self .assertIsInstance (MetadataPathFinder , type )
53
52
54
- @pytest .mark .xfail (reason = "Not implemented" )
55
53
@fixtures .parameterize (
56
54
dict (name = None ),
57
55
dict (name = '' ),
You can’t perform that action at this time.
0 commit comments