diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index 0260f7e38..ef0a4d1e0 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -11,10 +11,13 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.10", "pypy3.11"] # Fail-fast skews the pass/fail ratio and seems to make pytest produce # incomplete JUnit XML results. fail-fast: false + env: + install-opts: ${{ !startsWith(matrix.python-version, 'pypy') && '--extras grpc' || '' }} + pytest-opts: ${{ startsWith(matrix.python-version, 'pypy') && '-k "not grpc"' || '' }} steps: - name: Check out repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -25,36 +28,48 @@ jobs: python-version: ${{ matrix.python-version }} - name: Set up Poetry uses: ni/python-actions/setup-poetry@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1 - - name: Restore cached virtualenv (main only) - uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - id: restore-nidaqmx-main-only - with: - path: .venv - key: nidaqmx-main-only-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - - name: Install main package dependencies - run: | - python -m pip install --upgrade pip - poetry install --only main - - name: check installdriver subcommand can be invoked - run: poetry run nidaqmx installdriver --help - - name: Save cached virtualenv (main only) - uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - if: steps.restore-nidaqmx-main-only.outputs.cache-hit != 'true' - with: - path: .venv - key: ${{ steps.restore-nidaqmx-main-only.outputs.cache-primary-key }} - - name: Cache virtualenv (with dev dependencies) + - name: Cache virtualenv (with test dependencies) uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: .venv - key: nidaqmx-with-dev-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} - - name: Install dev dependencies - run: poetry install + key: nidaqmx-with-test-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + - name: Install test dependencies + run: poetry install --only main,test ${{ env.install-opts }} - name: Run unit tests - run: poetry run pytest -v --cov=generated/nidaqmx --junitxml=test_results/unit-${{ matrix.os }}-py${{ matrix.python-version }}.xml tests/unit + run: poetry run pytest -v --cov=generated/nidaqmx --junitxml=test_results/unit-${{ matrix.os }}-py${{ matrix.python-version }}.xml tests/unit ${{ env.pytest-opts }} - name: Upload test results uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: test_results_unit_${{ matrix.os }}_py${{ matrix.python-version }} path: test_results/*.xml - if: always() \ No newline at end of file + if: always() + test_installdriver: + name: Test installdriver + runs-on: + - ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ["3.9", "3.13", "pypy3.11"] + steps: + - name: Check out repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Set up Python ${{ matrix.python-version }} + uses: ni/python-actions/setup-python@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1 + id: setup-python + with: + python-version: ${{ matrix.python-version }} + - name: Set up Poetry + uses: ni/python-actions/setup-poetry@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1 + - name: Cache virtualenv (main only) + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + id: cache-nidaqmx-main-only + with: + path: .venv + key: nidaqmx-main-only-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} + - name: Install main package dependencies + run: | + python -m pip install --upgrade pip + poetry install --only main + - name: check installdriver subcommand can be invoked + run: poetry run nidaqmx installdriver --help \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a18c76b..89d8eabc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ All notable changes to this project will be documented in this file. distribution package and affected clients. Adding PyPy-specific constraints exacerbated this problem. Now, the distribution package specifies only a lower bound for the `numpy` and `click` versions. + * Clarify PyPy support and enable unit testing with PyPy. * ### Known Issues * ... diff --git a/README.rst b/README.rst index 300897a3b..758a88b5e 100644 --- a/README.rst +++ b/README.rst @@ -55,7 +55,10 @@ system. Python Version Support ---------------------- -**nidaqmx** supports CPython 3.9+ and PyPy3. +**nidaqmx** supports CPython 3.9+. + +**nidaqmx** supports PyPy3 for non-gRPC use cases. For the status of PyPy support for gRPC, +see `PyPy support (grpc/grpc#4221) `_. Installation ============