From 42919d26a6dbebc948dee00a8772e860c9951812 Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Thu, 28 Dec 2023 12:34:11 -0500 Subject: [PATCH] feat: switch to tox for tests --- .github/workflows/tests.yml | 43 ++++++++++++++++++++++++++----------- .gitignore | 1 + .readthedocs.yml | 2 +- requirements.dev.txt | 6 ------ tox.ini | 21 ++++++++++++++++++ 5 files changed, 53 insertions(+), 20 deletions(-) delete mode 100644 requirements.dev.txt create mode 100644 tox.ini diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f88d36572..4e191dd5f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,19 +33,36 @@ jobs: - name: Run tests run: | cmake --build build --target check - pytest: - runs-on: ubuntu-latest + python-tests: + name: test with ${{ matrix.py }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + py: + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + os: + - ubuntu-latest + - macos-latest + - windows-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install - run: | - sudo apt-get install sox - python -m pip install --upgrade pip - pip install -r requirements.dev.txt - pip install . - - name: Run tests - run: pytest + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup python for test ${{ matrix.py }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.py }} + - name: Install tox + run: python -m pip install tox-gh>=1.2 + - name: Setup test suite + run: tox -vv --notest + - name: Run test suite + run: tox --skip-pkg-install pytest-editable: runs-on: ubuntu-latest steps: @@ -55,7 +72,7 @@ jobs: run: | sudo apt-get install sox python -m pip install --upgrade pip - pip install -r requirements.dev.txt + pip install pytest memory_profiler pip install -e . - name: Run tests run: pytest diff --git a/.gitignore b/.gitignore index 2a70e1b52..6d2dbdd2d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ CTestTestfile.cmake DartConfiguration.tcl cmake_install.cmake +.tox diff --git a/.readthedocs.yml b/.readthedocs.yml index 0dcb2b426..d764d78e6 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -3,7 +3,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.9" + python: "3.10" sphinx: configuration: docs/source/conf.py diff --git a/requirements.dev.txt b/requirements.dev.txt deleted file mode 100644 index 7557df8da..000000000 --- a/requirements.dev.txt +++ /dev/null @@ -1,6 +0,0 @@ -cmake~=3.22.0 -scikit-build~=0.15.0 -Cython~=0.29.0 -setuptools>=45.0.0 -pytest~=7.0.0 -memory-profiler==0.60.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 000000000..08ce4b633 --- /dev/null +++ b/tox.ini @@ -0,0 +1,21 @@ +[tox] +env_list = py{38,39,310,311,312} +minversion = 4.11.4 + +[testenv] +description = run the tests with pytest +package = wheel +wheel_build_env = .pkg +deps = + pytest>=6 + memory_profiler +commands = + pytest {tty:--color=yes} {posargs} + +[gh] +python = + 3.12 = py312 + 3.11 = py311 + 3.10 = py310 + 3.9 = py39 + 3.8 = py38