Mark flaky tests on database handler tests on PyPy runtime

The database handler tests fail from time to time due to slow PyPy startup time
which results in tests failing unexpectedly which only happens on PyPy.

This PR requires CPython runtime to pass the tests and indicates failures,
but does not fail the test suite due to them.
This commit is contained in:
Aleksi Häkli 2021-03-01 13:33:27 +02:00
parent f6e6d32672
commit 69af352d6e

View file

@ -1,5 +1,8 @@
from platform import python_implementation
from unittest.mock import MagicMock, patch
from pytest import mark
from django.core.cache import cache
from django.test import override_settings
from django.urls import reverse
@ -206,6 +209,7 @@ class ResetAttemptsTestCase(AxesHandlerBaseTestCase):
AXES_COOLOFF_TIME=timedelta(seconds=2),
AXES_RESET_ON_SUCCESS=True,
)
@mark.xfail(python_implementation() == "PyPy", reason="PyPy implementation is flaky for this test", strict=False)
class AxesDatabaseHandlerTestCase(AxesHandlerBaseTestCase):
def test_handler_reset_attempts(self):
self.create_attempt()