'Python's unittest `assertCouldNotTest`? [closed]

I am using Python's unittest module to do some testing that some probability density functions that I have implemented integrate to 1. To test this I am using Scipy's quad function:

integral, err = integrate.quad(my_pdf, -float('inf'), float('inf'))
self.assertTrue(isclose(integral, 1))

where isclose is from Python's math. For some PDFs it happens that err is > 1 and integral is "very far from 1" such as I would consider this a fail. However this is not a fail of my_pdf but a fail of the testing method. To avoid flagging this as a fail I can do

if err > 1:
    continue

but in this case I completely skipping this case without any clue that it happened.

Is it possible to somehow flag this kind of failure within unittest? Somthing like

if err > 1:
    self.couldNotTest()

such that in the end unittest will tell me the number of tests that could not be performed?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source