From d983fcfe411d8c38f148c5542b21ce57daf39d48 Mon Sep 17 00:00:00 2001 From: Martin Glauer Date: Thu, 8 Aug 2024 10:46:17 +0200 Subject: [PATCH 1/7] Add actions for unittests --- .github/workflows/test.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..a687fdda --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Unittests + +on: [pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["pypy3.9", "pypy3.10", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Display Python version + run: python -m unittest \ No newline at end of file From 491428d6a445265fad45450c8212b8af9b3a3285 Mon Sep 17 00:00:00 2001 From: Martin Glauer Date: Thu, 8 Aug 2024 10:52:59 +0200 Subject: [PATCH 2/7] Add dependencies to test scipt --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a687fdda..28d9b4cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,5 +16,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools wheel + pip install -e . - name: Display Python version run: python -m unittest \ No newline at end of file From 04615d91769002ca9e6b092cfe3699a293909d0c Mon Sep 17 00:00:00 2001 From: Martin Glauer Date: Thu, 8 Aug 2024 11:01:08 +0200 Subject: [PATCH 3/7] Install cpu-based version of torch --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28d9b4cb..f2143ff2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install --upgrade pip setuptools wheel - pip install -e . + python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu + python -m pip install -e . - name: Display Python version run: python -m unittest \ No newline at end of file From 605064425dd220c8f19627c2386663b4665fd015 Mon Sep 17 00:00:00 2001 From: Martin Glauer Date: Thu, 8 Aug 2024 11:17:13 +0200 Subject: [PATCH 4/7] Disable fail-fast --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f2143ff2..a75533f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: ["pypy3.9", "pypy3.10", "3.9", "3.10", "3.11"] From 32a8052e1479d8dcdbb57fbe6aca3db3cecae36a Mon Sep 17 00:00:00 2001 From: sfluegel Date: Wed, 6 Nov 2024 15:09:29 +0100 Subject: [PATCH 5/7] run unittests only for tests/unit folder --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a75533f8..4ef35725 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,4 +24,4 @@ jobs: python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu python -m pip install -e . - name: Display Python version - run: python -m unittest \ No newline at end of file + run: python -m unittest discover -s tests/unit From 14741d3f18c86e874e454737a372e20d3fc4d407 Mon Sep 17 00:00:00 2001 From: sfluegel Date: Wed, 6 Nov 2024 15:15:32 +0100 Subject: [PATCH 6/7] remove T_co typehint (T_co does not exist for newer torch versions) --- chebai/preprocessing/structures.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chebai/preprocessing/structures.py b/chebai/preprocessing/structures.py index 1e384598..1fb3711a 100644 --- a/chebai/preprocessing/structures.py +++ b/chebai/preprocessing/structures.py @@ -2,7 +2,6 @@ import networkx as nx import torch -from torch.utils.data.dataset import T_co class XYData(torch.utils.data.Dataset): @@ -23,7 +22,7 @@ def __init__( self.x = x self.y = y - def __getitem__(self, index: int) -> T_co: + def __getitem__(self, index: int): """Returns the data and target at the given index.""" return self.x[index], self.y[index] From fdabd961d2eb7c3250ed3d45654e45fc9cc0dff8 Mon Sep 17 00:00:00 2001 From: sfluegel Date: Wed, 6 Nov 2024 15:37:26 +0100 Subject: [PATCH 7/7] remove pypy version --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ef35725..b0792c99 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["pypy3.9", "pypy3.10", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v4