Skip to content

Commit efa5a63

Browse files
committed
Automatically delete downloaded models after successful tests to avoid OOM
1 parent a3c2777 commit efa5a63

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/conftest.py

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4+
from pathlib import Path
45
from typing import Any
56

67
import pytest
@@ -16,3 +17,8 @@ def load(*args: Any, progress: bool = False, **kwargs: Any) -> Any:
1617
@pytest.fixture
1718
def load_state_dict_from_url(monkeypatch: MonkeyPatch) -> None:
1819
monkeypatch.setattr(torchvision.models._api, 'load_state_dict_from_url', load)
20+
21+
22+
@pytest.fixture(autouse=True)
23+
def torch_hub(tmp_path: Path) -> None:
24+
torch.hub.set_dir(tmp_path)

0 commit comments

Comments
 (0)