File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 55import pathlib
66import tempfile
77import textwrap
8+ import functools
89import contextlib
910
1011from .py39compat import FS_NONASCII
@@ -294,3 +295,18 @@ def setUp(self):
294295 # Add self.zip_name to the front of sys.path.
295296 self .resources = contextlib .ExitStack ()
296297 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 11import re
22import json
33import pickle
4+ import pytest
45import unittest
56import warnings
67import importlib
@@ -50,6 +51,15 @@ def test_new_style_classes(self):
5051 self .assertIsInstance (Distribution , type )
5152 self .assertIsInstance (MetadataPathFinder , type )
5253
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+
5363
5464class ImportTests (fixtures .DistInfoPkg , unittest .TestCase ):
5565 def test_import_nonexistent_module (self ):
You can’t perform that action at this time.
0 commit comments