File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 5
5
import pathlib
6
6
import tempfile
7
7
import textwrap
8
+ import functools
8
9
import contextlib
9
10
10
11
from .py39compat import FS_NONASCII
@@ -294,3 +295,18 @@ def setUp(self):
294
295
# Add self.zip_name to the front of sys.path.
295
296
self .resources = contextlib .ExitStack ()
296
297
self .addCleanup (self .resources .close )
298
+
299
+
300
+ def parameterize (* args_set ):
301
+ """Run test method with a series of parameters."""
302
+
303
+ def wrapper (func ):
304
+ @functools .wraps (func )
305
+ def _inner (self ):
306
+ for args in args_set :
307
+ with self .subTest (** args ):
308
+ func (self , ** args )
309
+
310
+ return _inner
311
+
312
+ return wrapper
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
4
5
import unittest
5
6
import warnings
6
7
import importlib
@@ -50,6 +51,15 @@ def test_new_style_classes(self):
50
51
self .assertIsInstance (Distribution , type )
51
52
self .assertIsInstance (MetadataPathFinder , type )
52
53
54
+ @pytest .mark .xfail (reason = "Not implemented" )
55
+ @fixtures .parameterize (
56
+ dict (name = None ),
57
+ dict (name = '' ),
58
+ )
59
+ def test_invalid_inputs_to_from_name (self , name ):
60
+ with self .assertRaises (Exception ):
61
+ Distribution .from_name (name )
62
+
53
63
54
64
class ImportTests (fixtures .DistInfoPkg , unittest .TestCase ):
55
65
def test_import_nonexistent_module (self ):
You can’t perform that action at this time.
0 commit comments