Skip to content

Instantly share code, notes, and snippets.

@juliomfreitas
juliomfreitas / gist:b06d92983d7697a746696613e6e36771
Last active October 22, 2016 03:10
how to use a test with expecting failure
class NotImplementedToExpectedFailure:
def run(self, result=None):
# Override the run method to inject the "expectingFailure" marker
# when the test case runs.
if self._testMethodName in getattr(self, 'not_implemented', []):
# Mark 'expecting failure' on class. It will only be applicable
# for this specific run.
method = getattr(self, self._testMethodName)
wrapper = lambda *args, **kwargs: method(*args, **kwargs)
wrapper.__unittest_expecting_failure__ = True
class B():
pass
class A():
pass
classes_dict = {"A": A, "B": B}