`test_environment_does_not_update_on_past_event` is flaky
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 50/100
Direzione di ricerca
Inizia da tests/test_streaming_manager.py ed esegui test_environment_does_not_update_on_past_event con Python 3.10 per riprodurre il fallimento intermittente. Ispeziona Flagsmith.handle_stream_event e le chiamate mock a update_environment; il lavoro è completato quando uno StreamEvent passato non chiama update_environment e i test del gestore dello streaming passano in modo affidabile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The following test is failing sometimes for Python 3.10:
============================= test session starts ==============================
platform linux -- Python 3.10.19, pytest-7.4.4, pluggy-1.5.0
rootdir: /home/runner/work/flagsmith-python-client/flagsmith-python-client
plugins: mock-3.14.1, cov-4.1.0, pyfakefs-5.9.2
collected 73 items
tests/test_analytics.py ..... [ 6%]
tests/test_flagsmith.py ........................................... [ 65%]
tests/test_models.py ............ [ 82%]
tests/test_offline_handlers.py .. [ 84%]
tests/test_polling_manager.py .... [ 90%]
tests/test_streaming_manager.py ..F. [ 95%]
tests/test_webhooks.py ... [100%]
=================================== FAILURES ===================================
________________ test_environment_does_not_update_on_past_event ________________
self = <MagicMock name='update_environment' id='140607846335680'>
def assert_not_called(self):
"""assert that the mock was never called.
"""
if self.call_count != 0:
msg = ("Expected '%s' to not have been called. Called %s times.%s"
% (self._mock_name or 'mock',
self.call_count,
self._calls_repr()))
> raise AssertionError(msg)
E AssertionError: Expected 'update_environment' to not have been called. Called 2 times.
E Calls: [call(), call()].
/opt/hostedtoolcache/Python/3.10.19/x64/lib/python3.10/unittest/mock.py:890: AssertionError
During handling of the above exception, another exception occurred:
server_api_key = 'ser.ZnjtUuLXOhrkpIQbVTJR'
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fe1d0bbc340>
def test_environment_does_not_update_on_past_event(
server_api_key: str, mocker: MockerFixture
) -> None:
stream_updated_at = datetime(2020, 1, 1, 1, 1, 1, tzinfo=timezone.utc)
environment_updated_at = datetime(2020, 1, 1, 1, 1, 2, tzinfo=timezone.utc)
mocker.patch("flagsmith.Flagsmith.update_environment")
flagsmith = Flagsmith(environment_key=server_api_key)
flagsmith._evaluation_context = MagicMock()
flagsmith._environment_updated_at = environment_updated_at
flagsmith.handle_stream_event(event=StreamEvent(updated_at=stream_updated_at))
assert isinstance(flagsmith.update_environment, Mock)
> flagsmith.update_environment.assert_not_called()
E AssertionError: Expected 'update_environment' to not have been called. Called 2 times.
E Calls: [call(), call()].
tests/test_streaming_manager.py:68: AssertionError
=========================== short test summary info ============================
FAILED tests/test_streaming_manager.py::test_environment_does_not_update_on_past_event - AssertionError: Expected 'update_environment' to not have been called. Called 2 times.
Calls: [call(), call()].
========================= 1 failed, 72 passed in 0.80s =========================
- Lingua principale
- Python
- Stelle
- 24
- Fork
- 12
- Merge medio
- 15h 43m
- PR unite (30g)
- 4
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Flagsmith/flagsmith-python-client
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
-
Dependency Dashboard Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
Flagsmith/flagsmith-python-client#198 · 1 commento · 2 assegnatari ·
Tutte le issue di Flagsmith/flagsmith-python-client
Issue simili
-
Add: hunch Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DiamondLightSource/dodal#2211 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
openml/openml-python#1749 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sipyourdrink-ltd/bernstein#6191 ·