Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: check that intended exception messages emerge #733

Open
sadielbartholomew opened this issue Mar 4, 2024 · 0 comments
Open

Tests: check that intended exception messages emerge #733

sadielbartholomew opened this issue Mar 4, 2024 · 0 comments
Labels
testing Issues related to units tests and their coverage

Comments

@sadielbartholomew
Copy link
Member

sadielbartholomew commented Mar 4, 2024

To help to avoid bugs whereby an untrue and/or misleading exception message is raised due to some logical issue, such as #732, we should try to test not only that an exception is raised for some cf-python code but that it is the specific one that should be (e.g. ValueError and not just a general Exception) and that the specific error message is correct (bar details that will change which can be selectively ignored), via providing the appropriate string or regex to assertRaisesRegex.

There are (git grep "assertRaises" | wc -l =) 245 uses of assertRaises in the full test suite to test that some exception is raised when it should be, and I imagine most if not all of these can be upgraded in this sense.

See #732 (comment) for a small example I have included.

@sadielbartholomew sadielbartholomew added the testing Issues related to units tests and their coverage label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Issues related to units tests and their coverage
Projects
None yet
Development

No branches or pull requests

1 participant