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

Change ESMPy xfails to expected exception tests #265

Open
billsacks opened this issue Jul 22, 2024 · 0 comments
Open

Change ESMPy xfails to expected exception tests #265

billsacks opened this issue Jul 22, 2024 · 0 comments
Labels
enhancement New feature or request ESMPy

Comments

@billsacks
Copy link
Member

billsacks commented Jul 22, 2024

I noticed that at least some of the xfails we have in ESMPy testing are tests that exceptions are caught appropriately - e.g., test_interfaceint2 in test_cbindings.py:

@pytest.mark.xfail
def test_interfaceint2(self):
# This test should fail
try:
a = (ct.c_int*3)()
a = [1,2,3]
interfaceint2 = ESMP_InterfaceInt(a)
except:
raise TypeError('FAIL: tuples cannot be used in place of numpy.array')

I haven't looked closely, but I think these could / should be converted to expected exception handling - e.g., see https://pytest-with-eric.com/introduction/pytest-assert-exception/

Benefits would be:

(1) The test results would be cleaner: I think of xfails as being tests that are currently not working right that we want to fix eventually, and a completely clean test result wouldn't have any xfails.

(2) We could ensure that the correct exception is being raised.

@billsacks billsacks added enhancement New feature or request ESMPy labels Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ESMPy
Projects
None yet
Development

No branches or pull requests

1 participant