Skip to content

Commit

Permalink
Change from using flaky to pytest_rerunfailures (equinor#7346)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq authored Mar 4, 2024
1 parent 5f5bff1 commit 126ac6b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Repository = "https://github.com/equinor/ert"
dev = [
"decorator",
"furo",
"flaky",
"hypothesis",
"jsonpath_ng",
"jupytext",
Expand All @@ -108,10 +107,11 @@ dev = [
"pytest-mpl",
"pytest-qt",
"pytest-raises",
"pytest-rerunfailures",
"pytest-snapshot",
"pytest-timeout",
"pytest-xdist",
"pytest>6,<8.1.0",
"pytest>6",
"resfo",
"scikit-learn",
"sphinx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import numpy as np
import pytest
import xtgeo
from flaky import flaky

from ert.cli import ENSEMBLE_SMOOTHER_MODE
from ert.libres_facade import LibresFacade
Expand Down Expand Up @@ -179,7 +178,7 @@ def test_surface_param_update(tmpdir):

@pytest.mark.integration_test
@pytest.mark.limit_memory("110 MB")
@flaky(max_runs=5, min_passes=1)
@pytest.mark.flaky(reruns=5)
def test_field_param_memory(tmpdir):
with tmpdir.as_cwd():
# Setup is done in a subprocess so that memray does not pick up the allocations
Expand Down
3 changes: 1 addition & 2 deletions tests/performance_tests/test_memory_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import py
import pytest
import xarray as xr
from flaky import flaky

from ert.analysis import smoother_update
from ert.config import ErtConfig, SummaryConfig
Expand Down Expand Up @@ -40,7 +39,7 @@ def poly_template(monkeypatch):
yield folder


@flaky(max_runs=5, min_passes=1)
@pytest.mark.flaky(reruns=5)
@pytest.mark.limit_memory("130 MB")
@pytest.mark.integration_test
def test_memory_smoothing(poly_template):
Expand Down
3 changes: 1 addition & 2 deletions tests/unit_tests/job_queue/test_ert_qstat_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import pytest
import testpath
from flaky import flaky

from ert import _clib

Expand Down Expand Up @@ -241,7 +240,7 @@ def test_options_passed_through_proxy(tmpdir, options, expected, monkeypatch):
# (the output from the mocked qstat happens to adhere to json syntax)


@flaky
@pytest.mark.flaky(reruns=5)
@pytest.mark.skipif(sys.platform.startswith("darwin"), reason="No flock on MacOS")
def test_many_concurrent_qstat_invocations(tmpdir, monkeypatch):
"""Run many qstat invocations simultaneously, with a mocked backend qstat
Expand Down
3 changes: 1 addition & 2 deletions tests/unit_tests/job_runner/test_event_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from unittest.mock import patch

import pytest
from flaky import flaky

from _ert_job_runner.client import ClientConnectionClosedOK, ClientConnectionError
from _ert_job_runner.job import Job
Expand Down Expand Up @@ -200,7 +199,7 @@ def mock_send(msg):
assert len(lines) == 0, "expected 0 Job running messages"


@flaky
@pytest.mark.flaky(reruns=5)
@pytest.mark.skipif(
sys.platform.startswith("darwin"), reason="Performance can be flaky"
)
Expand Down
3 changes: 1 addition & 2 deletions tests/unit_tests/job_runner/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from unittest.mock import PropertyMock, patch

import pytest
from flaky import flaky

from _ert_job_runner.job import Job
from _ert_job_runner.reporting.message import Exited, Running, Start
Expand Down Expand Up @@ -34,7 +33,7 @@ def test_run_with_process_failing(
next(run)


@flaky
@pytest.mark.flaky(reruns=5)
@pytest.mark.usefixtures("use_tmpdir")
def test_memory_usage_counts_grandchildren():
scriptname = "recursive_memory_hog.py"
Expand Down
5 changes: 2 additions & 3 deletions tests/unit_tests/scheduler/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import pytest
from cloudevents.http import from_json
from flaky import flaky

from ert.constant_filenames import CERT_FILE
from ert.ensemble_evaluator._builder._realization import Realization
Expand Down Expand Up @@ -381,7 +380,7 @@ async def wait(iens):
assert killed_iens == [6, 7, 8, 9]


@flaky(max_runs=5, min_passes=1)
@pytest.mark.flaky(reruns=5)
@pytest.mark.parametrize(
"submit_sleep, iens_stride, realization_runtime",
[(0, 1, 0.1), (0.1, 1, 0.1), (0.1, 1, 0), (0.1, 2, 0)],
Expand Down Expand Up @@ -424,7 +423,7 @@ async def wait():
assert max(deltas) <= submit_sleep + 0.1


@flaky(max_runs=5, min_passes=1)
@pytest.mark.flaky(reruns=5)
@pytest.mark.parametrize(
"submit_sleep, realization_max_runtime, max_running",
[
Expand Down

0 comments on commit 126ac6b

Please sign in to comment.