Skip to content

Commit

Permalink
Add xfail test capturing new expectation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 23, 2022
1 parent e5b7d87 commit a4ae953
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pathlib
import tempfile
import textwrap
import functools
import contextlib

from .py39compat import FS_NONASCII
Expand Down Expand Up @@ -294,3 +295,18 @@ def setUp(self):
# Add self.zip_name to the front of sys.path.
self.resources = contextlib.ExitStack()
self.addCleanup(self.resources.close)


def parameterize(*args_set):
"""Run test method with a series of parameters."""

def wrapper(func):
@functools.wraps(func)
def _inner(self):
for args in args_set:
with self.subTest(**args):
func(self, **args)

return _inner

return wrapper
10 changes: 10 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
import json
import pickle
import pytest
import unittest
import warnings
import importlib
Expand Down Expand Up @@ -50,6 +51,15 @@ def test_new_style_classes(self):
self.assertIsInstance(Distribution, type)
self.assertIsInstance(MetadataPathFinder, type)

@pytest.mark.xfail(reason="Not implemented")
@fixtures.parameterize(
dict(name=None),
dict(name=''),
)
def test_invalid_inputs_to_from_name(self, name):
with self.assertRaises(Exception):
Distribution.from_name(name)


class ImportTests(fixtures.DistInfoPkg, unittest.TestCase):
def test_import_nonexistent_module(self):
Expand Down

0 comments on commit a4ae953

Please sign in to comment.