Skip to content

Commit

Permalink
Add a test class inheriting unittest.TestCase to exemplify a bug
Browse files Browse the repository at this point in the history
- This commit shows how pytest does not seem to retry the failing test
  case if it's inheriting from TestCase. Bug?
  • Loading branch information
simlun committed Mar 9, 2015
1 parent 4885bee commit 6c0c7fc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/test_pytest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pytest
# pylint:enable=import-error
from flaky import flaky
from unittest import TestCase


@flaky
Expand Down Expand Up @@ -74,3 +75,16 @@ def test_flaky_thing_that_fails_then_succeeds(self):
"""
self._threshold += 1
assert self._threshold >= 1


@flaky
class TestExampleFlakyTestsThatsInheritingTestCase(TestCase):
_threshold = -1

def test_flaky_thing_that_fails_then_succeeds(self):
"""
Flaky will run this test twice.
It will fail once and then succeed.
"""
self._threshold += 1
assert self._threshold >= 1

0 comments on commit 6c0c7fc

Please sign in to comment.