diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index c58844bbf110..846e461b5e46 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -172,18 +172,6 @@ jobs: with: python-version: ${{ matrix.python }} - - name: Install specific pytest version - if: matrix.pytest-version == 'pytest@pre-release' - run: | - python -m pip install --pre pytest - - - name: Install specific pytest version - if: matrix.pytest-version != 'pytest@pre-release' - run: | - python -m pip install "${{ matrix.pytest-version }}" - - - name: Install specific pytest version - run: python -m pytest --version - name: Install base Python requirements uses: brettcannon/pip-secure-install@92f400e3191171c1858cc0e0d9ac6320173fdb0c # v1.0.0 with: @@ -193,6 +181,19 @@ jobs: - name: Install test requirements run: python -m pip install --upgrade -r build/test-requirements.txt + # Install the specific pytest version AFTER test-requirements.txt so it is not + # overridden by the `pytest<8.1` pin (needed for pytest-black compatibility). + - name: Install specific pytest version (pre-release) + if: matrix.pytest-version == 'pytest@pre-release' + run: python -m pip install --upgrade --pre pytest + + - name: Install specific pytest version + if: matrix.pytest-version != 'pytest@pre-release' + run: python -m pip install --upgrade "${{ matrix.pytest-version }}" + + - name: Print pytest version + run: python -m pytest --version + - name: Run Python unit tests run: python python_files/tests/run_all.py