Skip to content

Commit

Permalink
update tests runner
Browse files Browse the repository at this point in the history
  • Loading branch information
michalwols committed Jan 16, 2025
1 parent cacceb6 commit 7919910
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Tests

on:
Expand All @@ -11,23 +8,28 @@ on:

jobs:
build:
runs-on: macos-latest
strategy:
matrix:
python-version: [3.7]
os: [ubuntu-latest, macos-latest]
python-version: [3.9, 3.10, 3.11]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
- name: Check out code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements-dev.txt || true
pip install -r requirements.txt || true
pip install numpy scipy
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
pytest --mocha
11 changes: 9 additions & 2 deletions tests/data/test_place.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import torch
import pytest

from yann.data.place import Place


def test_place():
devices = ['cpu', 'cuda'] if torch.cuda.is_available() else ['cpu']


@pytest.mark.parametrize('device', devices)
def test_place(device):
import torch
tuple_batch = (torch.rand(3,3), torch.rand(3,1), 'foo')

place = Place(('cpu', 'cuda'))
place = Place(('cpu', device))
b = place(tuple_batch)
# assert b[0].device == 'cpu'
assert b[2] == 'foo'

0 comments on commit 7919910

Please sign in to comment.