Skip to content

Instantly share code, notes, and snippets.

@juliomfreitas
Last active October 22, 2016 03:10
Show Gist options
  • Select an option

  • Save juliomfreitas/b06d92983d7697a746696613e6e36771 to your computer and use it in GitHub Desktop.

Select an option

Save juliomfreitas/b06d92983d7697a746696613e6e36771 to your computer and use it in GitHub Desktop.

Revisions

  1. juliomfreitas revised this gist Oct 22, 2016. 1 changed file with 9 additions and 2 deletions.
    11 changes: 9 additions & 2 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -14,5 +14,12 @@ def run(self, result=None):
    class BinaryBoolOperationTests(NotImplementedToExpectedFailure):

    not_implemented = [
    'test_add_class',
    ]
    'test_add_class'
    ]

    def test_add_class(self):
    pass

    def test_add_complex(self):
    pass

  2. juliomfreitas revised this gist Oct 22, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -10,3 +10,9 @@ def run(self, result=None):
    wrapper.__unittest_expecting_failure__ = True
    setattr(self, self._testMethodName, wrapper)
    return super().run(result=result)

    class BinaryBoolOperationTests(NotImplementedToExpectedFailure):

    not_implemented = [
    'test_add_class',
    ]
  3. juliomfreitas renamed this gist Oct 22, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. juliomfreitas created this gist Oct 22, 2016.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    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)