Last active
October 22, 2016 03:10
-
-
Save juliomfreitas/b06d92983d7697a746696613e6e36771 to your computer and use it in GitHub Desktop.
how to use a test with expecting failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
setattr(self, self._testMethodName, wrapper) | |
return super().run(result=result) | |
class BinaryBoolOperationTests(NotImplementedToExpectedFailure): | |
not_implemented = [ | |
'test_add_class' | |
] | |
def test_add_class(self): | |
pass | |
def test_add_complex(self): | |
pass | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment