Skip to content

Commit a4ae953

Browse files
committed
Add xfail test capturing new expectation.
1 parent e5b7d87 commit a4ae953

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/fixtures.py

+16
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pathlib
66
import tempfile
77
import textwrap
8+
import functools
89
import contextlib
910

1011
from .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

tests/test_main.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import re
22
import json
33
import pickle
4+
import pytest
45
import unittest
56
import warnings
67
import 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

5464
class ImportTests(fixtures.DistInfoPkg, unittest.TestCase):
5565
def test_import_nonexistent_module(self):

0 commit comments

Comments
 (0)