avoid OOMs in SAM tests

This commit is contained in:
Pierre Chapuis 2024-06-24 16:27:30 +02:00
parent 91c0fd24d8
commit 9be3580ab3

View file

@ -1,9 +1,17 @@
import gc
from pathlib import Path from pathlib import Path
from warnings import warn from warnings import warn
from pytest import fixture, skip from pytest import fixture, skip
@fixture(autouse=True)
def ensure_gc():
# Avoid GPU OOMs
# See https://github.com/pytest-dev/pytest/discussions/8153#discussioncomment-214812
gc.collect()
@fixture(scope="package") @fixture(scope="package")
def ref_path(test_sam_path: Path) -> Path: def ref_path(test_sam_path: Path) -> Path:
return test_sam_path / "test_sam_ref" return test_sam_path / "test_sam_ref"