From 6739332096453bc335d4c413a0988d4cbe1ba7d6 Mon Sep 17 00:00:00 2001 From: Yuichi Motoyama Date: Tue, 4 Jun 2024 11:25:03 +0900 Subject: [PATCH] update github actions (#54) * test for python 3.11 * fixed a typo * use setup-python@v5 --- .github/workflows/deploy_docs.yml | 6 +++--- .github/workflows/deploy_pypi.yml | 4 ++-- .github/workflows/python_package.yml | 8 ++++---- tests/unit/test_variable.py | 18 +++--------------- tox.ini | 3 ++- 5 files changed, 14 insertions(+), 25 deletions(-) diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index a1569475..250c837d 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -17,19 +17,19 @@ jobs: uses: rlespinasse/github-slug-action@v4.x - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: main fetch-depth: 0 - name: Checkout gh-pages - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: gh-pages path: gh-pages - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.github/workflows/deploy_pypi.yml b/.github/workflows/deploy_pypi.yml index c7183a9e..87f08156 100644 --- a/.github/workflows/deploy_pypi.yml +++ b/.github/workflows/deploy_pypi.yml @@ -10,10 +10,10 @@ jobs: if: github.repository == 'issp-center-dev/PHYSBO' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index af4caba4..7413f21e 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -4,17 +4,17 @@ on: [push] jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: fail-fast: false max-parallel: 3 matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/tests/unit/test_variable.py b/tests/unit/test_variable.py index 6b77c999..663f75fe 100644 --- a/tests/unit/test_variable.py +++ b/tests/unit/test_variable.py @@ -36,15 +36,6 @@ def test_get_subset(variable, X, t, Z, index): assert np.array_equal(var2.Z, Z[index, :]) -def test_delete(variable, mocker): - delete_X = mocker.patch("physbo.variable.delete_X") - delete_t = mocker.patch("physbo.variable.delete_t") - delete_Z = mocker.patch("physbo.variable.delete_Z") - variable.delete(1) - delete_X.assert_called_once_with(1) - delete_t.assert_called_once_with(1) - delete_Z.assert_called_once_with(1) - @pytest.mark.parametrize("index", [2, [0, 1]]) def test_delete_X(variable, X, index): @@ -68,13 +59,10 @@ def test_delete_Z(variable, Z, index): def test_add(variable, X, t, Z, mocker): - add_X = mocker.patch("physbo.variable.add_X") - add_t = mocker.patch("physbo.variable.add_t") - add_Z = mocker.patch("physbo.variable.add_Z") variable.add(X, t, Z) - add_X.assert_called_once_with(X) - add_t.assert_called_once_with(t) - add_Z.assert_called_once_with(Z) + assert np.array_equal(variable.X, np.vstack((X,X))) + assert np.array_equal(variable.t, np.hstack((t,t))) + assert np.array_equal(variable.Z, np.vstack((Z,Z))) def test_add_X(variable, X): diff --git a/tox.ini b/tox.ini index c2fb14c9..e022c75d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] requires = tox>=4 -envlist = py37, py38, py39, py310, docs +envlist = py37, py38, py39, py310, py311, docs isolated_build = true [gh-actions] @@ -9,6 +9,7 @@ python = '3.8': py38 '3.9': py39 '3.10': py310 + '3.11': py311 [testenv] deps =