Skip to content

Commit

Permalink
Tests: set matplotlib backend locally too (#2326)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart authored Sep 28, 2024
1 parent 69f91a2 commit 742b900
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
latest:
name: latest
runs-on: ${{ matrix.os }}
env:
MPLBACKEND: Agg
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
Expand Down Expand Up @@ -55,8 +53,6 @@ jobs:
minimum:
name: minimum
runs-on: ubuntu-latest
env:
MPLBACKEND: Agg
steps:
- name: Clone repo
uses: actions/[email protected]
Expand Down Expand Up @@ -90,8 +86,6 @@ jobs:
datasets:
name: datasets
runs-on: ubuntu-latest
env:
MPLBACKEND: Agg
steps:
- name: Clone repo
uses: actions/[email protected]
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from typing import Any

import matplotlib
import pytest
import torch
import torchvision
Expand All @@ -19,6 +20,11 @@ def load_state_dict_from_url(monkeypatch: MonkeyPatch) -> None:
monkeypatch.setattr(torchvision.models._api, 'load_state_dict_from_url', load)


@pytest.fixture(autouse=True, scope='session')
def matplotlib_backend() -> None:
matplotlib.use('agg')


@pytest.fixture(autouse=True)
def torch_hub(tmp_path: Path) -> None:
torch.hub.set_dir(tmp_path) # type: ignore[no-untyped-call]

0 comments on commit 742b900

Please sign in to comment.