Skip to content

Show the requirement in the load() ValueError - #185

Open
abhishekcpp007 wants to merge 1 commit into
scientific-python:mainfrom
abhishekcpp007:fix/require-error-message
Open

abhishekcpp007 wants to merge 1 commit into
scientific-python:mainfrom
abhishekcpp007:fix/require-error-message

Conversation

@abhishekcpp007

Copy link
Copy Markdown

The second half of the message in load() is missing its f prefix, so the requirement is printed as a literal {require}:

>>> lazy.load("json", require="not-a-dist-xyz>=1")
ValueError: Found module 'json' but cannot test requirement '{require}'. Requirements must match distribution name, not module name.

Added the f, and gave the existing pytest.raises(ValueError) in test_require_kwarg a match so it checks the message.

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.72%. Comparing base (78f2b45) to head (bfc0d91).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #185   +/-   ##
=======================================
  Coverage   96.72%   96.72%           
=======================================
  Files           1        1           
  Lines         122      122           
  Branches       23       23           
=======================================
  Hits          118      118           
  Misses          1        1           
  Partials        3        3           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants