From ca549c931b8d50ecfd1d9310015b9b06172b6d9f Mon Sep 17 00:00:00 2001 From: Sondre Sortland Date: Fri, 8 Mar 2024 15:14:27 +0100 Subject: [PATCH] Use block storage path fixture in storage test --- tests/conftest.py | 11 +++++++++++ tests/integration_tests/test_storage_migration.py | 5 ++--- tests/unit_tests/storage/migration/conftest.py | 12 ------------ 3 files changed, 13 insertions(+), 15 deletions(-) delete mode 100644 tests/unit_tests/storage/migration/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py index e4f83281242..e9e22998c85 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -412,6 +412,17 @@ def snake_oil_default_storage(snake_oil_case_storage): yield storage.get_ensemble_by_name("default_0") +@pytest.fixture(scope="session") +def block_storage_path(source_root): + path = source_root / "test-data/block_storage/snake_oil" + if not path.is_dir(): + pytest.skip( + "'test-data/block_storage' has not been checked out.\n" + "Run: git submodule update --init --recursive" + ) + return path.parent + + @pytest.fixture(autouse=True) def no_cert_in_test(monkeypatch): # Do not generate certificates during test, parts of it can be time diff --git a/tests/integration_tests/test_storage_migration.py b/tests/integration_tests/test_storage_migration.py index 3da74cb781e..f8df6db6f63 100644 --- a/tests/integration_tests/test_storage_migration.py +++ b/tests/integration_tests/test_storage_migration.py @@ -1,5 +1,4 @@ import shutil -from pathlib import Path import numpy as np @@ -8,9 +7,9 @@ from ert.storage.local_storage import local_storage_set_ert_config -def test_that_storage_matches(tmp_path, source_root, snapshot, monkeypatch): +def test_that_storage_matches(tmp_path, block_storage_path, snapshot, monkeypatch): shutil.copytree( - Path(source_root) / "test-data/block_storage/all_data_types/", + block_storage_path / "all_data_types/", tmp_path / "all_data_types", ) monkeypatch.chdir(tmp_path / "all_data_types") diff --git a/tests/unit_tests/storage/migration/conftest.py b/tests/unit_tests/storage/migration/conftest.py deleted file mode 100644 index d36b1d265e0..00000000000 --- a/tests/unit_tests/storage/migration/conftest.py +++ /dev/null @@ -1,12 +0,0 @@ -import pytest - - -@pytest.fixture(scope="session") -def block_storage_path(source_root): - path = source_root / "test-data/block_storage/snake_oil" - if not path.is_dir(): - pytest.skip( - "'test-data/block_storage' has not been checked out.\n" - "Run: git submodule update --init --recursive" - ) - return path.parent