Skip to content

Commit fd5a224

Browse files
committed
Fixed offline artifact tests
1 parent 2429cdd commit fd5a224

3 files changed

Lines changed: 5 additions & 17 deletions

File tree

tests/conftest.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,3 @@ def setup_test_run(run: sv_run.Run, create_objects: bool, request: pytest.Fixtur
303303
TEST_DATA["alert_ids"] = _alert_ids
304304

305305
return TEST_DATA
306-
307-
308-
@pytest.fixture
309-
def offline_test() -> pathlib.Path:
310-
with tempfile.TemporaryDirectory() as tempd:
311-
_tempdir = pathlib.Path(tempd)
312-
_cache_dir = _tempdir.joinpath(".simvue")
313-
_cache_dir.mkdir(exist_ok=True)
314-
os.environ["SIMVUE_OFFLINE_DIRECTORY"] = f"{_cache_dir}"
315-
assert sv_cfg.SimvueConfiguration.fetch().offline.cache == _cache_dir
316-
yield _tempdir
317-

tests/unit/test_file_artifact.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ def test_file_artifact_creation_online() -> None:
5151

5252
@pytest.mark.api
5353
@pytest.mark.offline
54-
def test_file_artifact_creation_offline(offline_test: pathlib.Path, offline_cache_setup) -> None:
54+
def test_file_artifact_creation_offline(offline_cache_setup) -> None:
5555
_uuid: str = f"{uuid.uuid4()}".split("-")[0]
5656
_folder_name = f"/simvue_unit_testing/{_uuid}"
5757
_folder = Folder.new(path=_folder_name, offline=True)
5858
_run = Run.new(name=f"test_file_artifact_creation_offline_{_uuid}",folder=_folder_name, offline=True)
5959

60-
_path = offline_test.joinpath("hello_world.txt")
60+
_path = pathlib.Path(offline_cache_setup.name).joinpath("hello_world.txt")
6161

6262
with _path.open("w") as out_f:
6363
out_f.write(f"Hello World! {_uuid}")
@@ -80,7 +80,7 @@ def test_file_artifact_creation_offline(offline_test: pathlib.Path, offline_cach
8080
assert _local_data.get("name") == f"test_file_artifact_{_uuid}"
8181
assert _local_data.get("runs") == {_run._identifier: "input"}
8282

83-
_id_mapping = sender(offline_test.joinpath(".simvue"), 1, 10)
83+
_id_mapping = sender(pathlib.Path(offline_cache_setup.name), 1, 10)
8484
time.sleep(1)
8585

8686
_online_artifact = Artifact(_id_mapping[_artifact.id])

tests/unit/test_object_artifact.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_object_artifact_creation_online() -> None:
3838

3939
@pytest.mark.api
4040
@pytest.mark.offline
41-
def test_object_artifact_creation_offline(offline_test: pathlib.Path, offline_cache_setup) -> None:
41+
def test_object_artifact_creation_offline(offline_cache_setup) -> None:
4242
_uuid: str = f"{uuid.uuid4()}".split("-")[0]
4343
_folder_name = f"/simvue_unit_testing/{_uuid}"
4444
_folder = Folder.new(path=_folder_name, offline=True)
@@ -63,7 +63,7 @@ def test_object_artifact_creation_offline(offline_test: pathlib.Path, offline_ca
6363
assert _local_data.get("mime_type") == "application/vnd.simvue.numpy.v1"
6464
assert _local_data.get("runs") == {_run.id: "input"}
6565

66-
_id_mapping = sender(offline_test.joinpath(".simvue"), 1, 10)
66+
_id_mapping = sender(pathlib.Path(offline_cache_setup.name), 1, 10)
6767
time.sleep(1)
6868

6969
_online_artifact = Artifact(_id_mapping.get(_artifact.id))

0 commit comments

Comments
 (0)