Skip to content

Commit

Permalink
Extract common code path in test fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Oct 1, 2024
1 parent a5216de commit 02f0ae4
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions tests/ert/ui_tests/gui/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,28 +215,26 @@ def esmda_has_run(_esmda_run, tmp_path, monkeypatch):
def ensemble_experiment_has_run(
tmp_path, monkeypatch, run_experiment, source_root, tmp_path_factory
):
monkeypatch.chdir(tmp_path)
test_files = _ensemble_experiment_run(
run_experiment, source_root, tmp_path_factory, True
yield from _ensemble_experiment_has_run(
tmp_path, monkeypatch, run_experiment, source_root, tmp_path_factory, True
)
shutil.copytree(test_files, tmp_path, dirs_exist_ok=True)
with _open_main_window(tmp_path / "poly.ert") as (
gui,
_,
config,
), StorageService.init_service(
project=os.path.abspath(config.ens_path),
):
yield gui


@pytest.fixture
def ensemble_experiment_has_run_no_failure(
tmp_path, monkeypatch, run_experiment, source_root, tmp_path_factory
):
yield from _ensemble_experiment_has_run(
tmp_path, monkeypatch, run_experiment, source_root, tmp_path_factory, False
)


def _ensemble_experiment_has_run(
tmp_path, monkeypatch, run_experiment, source_root, tmp_path_factory, failing
):
monkeypatch.chdir(tmp_path)
test_files = _ensemble_experiment_run(
run_experiment, source_root, tmp_path_factory, False
run_experiment, source_root, tmp_path_factory, failing
)
shutil.copytree(test_files, tmp_path, dirs_exist_ok=True)
with _open_main_window(tmp_path / "poly.ert") as (
Expand Down

0 comments on commit 02f0ae4

Please sign in to comment.