diff --git a/src/lazy_loader/__init__.py b/src/lazy_loader/__init__.py index 645b116..78bc3ee 100644 --- a/src/lazy_loader/__init__.py +++ b/src/lazy_loader/__init__.py @@ -269,7 +269,7 @@ def myfunc(): except ModuleNotFoundError as e: raise ValueError( f"Found module '{fullname}' but cannot test " - "requirement '{require}'. " + f"requirement '{require}'. " "Requirements must match distribution name, not module name." ) from e diff --git a/tests/test_lazy_loader.py b/tests/test_lazy_loader.py index b761fd2..8def656 100644 --- a/tests/test_lazy_loader.py +++ b/tests/test_lazy_loader.py @@ -261,7 +261,7 @@ def test_require_kwarg(): # When a module can be loaded but the version can't be checked, # raise a ValueError - with pytest.raises(ValueError): + with pytest.raises(ValueError, match="requirement 'somepkg >= 1.0'"): lazy.load("math", require="somepkg >= 1.0")