You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A fixture might be trying to grab a not-necessarily-available resource, like a database connection. The fixture should be able to invoke skipTest(). This was possible when overriding the setUp() method, but in the new _setUp() convention, all exception are caught including skip exceptions. Fixture should have a skip() method and setUp() should handle this special exception as a skip for the test overall.
The text was updated successfully, but these errors were encountered:
So the issue here is that if you raise an exception of type X, it gets masked to type MultipleExceptions; and test runners don't generally know how to unpack that.
Its plausible that we could teach them one by one, but it would be better to not mask the type. The reason we mask the type is because we need to add additional information beyond the original exception to deal with the general case of an exception circumstance with details captured in the fixture's details that are important.
This is still arguably important for SkipTest debugging, though folk can probably work around that if they have to.
I think something like this would work:
raise fixtures.OriginalException(unittest2.SkipTest('MySQL not installed'))
With a matching change to setUp to examine err, and if it is an OriginalException, only raise the original exception, accepting that we're going to discard information.
Regarding your proposed approach - adding a skip method - fixtures are not test code [though that is one important use case for them] - adding skip() wouldn't fit well, and it would also have the problem of having to choose which test framework's skip exception to raise - and there are so many :(.
somewhere in oslo.db we are doing a thing where we just specify actual exception classes to pass through, on another exception-handling structure. A hook method such as "shouldPassThrough(exception_class)" on Fixture could achieve this.
A fixture might be trying to grab a not-necessarily-available resource, like a database connection. The fixture should be able to invoke skipTest(). This was possible when overriding the setUp() method, but in the new _setUp() convention, all exception are caught including skip exceptions. Fixture should have a skip() method and setUp() should handle this special exception as a skip for the test overall.
The text was updated successfully, but these errors were encountered: