From 8acef7d097992016795a00b3f7e883d4b8123b49 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 11 Sep 2023 22:41:19 +0300 Subject: [PATCH 1/3] Add support for Python 3.12 --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8914615..a5032040 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,21 +6,25 @@ on: pull_request: branches: [ master ] +env: + FORCE_COLOR: 1 + jobs: test: runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy3.9"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install packages run: | From 76d35fd5f1a77d678d7cade0224691c3fc392669 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 11 Sep 2023 22:45:40 +0300 Subject: [PATCH 2/3] pytest: drop the dot --- .github/workflows/ci.yml | 2 +- .travis.yml | 2 +- DEVELOPERS.rst | 4 ++-- tests/README | 4 ++-- tools/teamcity-runtests.sh | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5032040..b658f87a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: run: | ./tools/display-sighandlers.py ./tools/display-terminalinfo.py - py.test --cov pexpect --cov-config .coveragerc + pytest --cov pexpect --cov-config .coveragerc - name: Check coverage env: diff --git a/.travis.yml b/.travis.yml index 217c443e..454246ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ install: script: - ./tools/display-sighandlers.py - ./tools/display-terminalinfo.py - - py.test --cov pexpect --cov-config .coveragerc + - pytest --cov pexpect --cov-config .coveragerc after_success: - coverage combine diff --git a/DEVELOPERS.rst b/DEVELOPERS.rst index bf2bb9f3..d681ad7f 100644 --- a/DEVELOPERS.rst +++ b/DEVELOPERS.rst @@ -1,6 +1,6 @@ -To run the tests, use `py.test `_:: +To run the tests, use `pytest `_:: - py.test tests + pytest tests The tests are all located in the tests/ directory. To add a new unit test all you have to do is create the file in the tests/ directory with a diff --git a/tests/README b/tests/README index ef5b6134..602b458a 100644 --- a/tests/README +++ b/tests/README @@ -1,8 +1,8 @@ The best way to run these tests is from the directory above this one. Run: - py.test + pytest To run a specific test file: - py.test tests/test_constructor.py + pytest tests/test_constructor.py diff --git a/tools/teamcity-runtests.sh b/tools/teamcity-runtests.sh index bcb28f78..86381faf 100755 --- a/tools/teamcity-runtests.sh +++ b/tools/teamcity-runtests.sh @@ -41,7 +41,7 @@ pip install --upgrade pytest-cov coverage coveralls pytest-capturelog # run tests cd $here/.. ret=0 -py.test \ +pytest \ --cov pexpect \ --cov-config .coveragerc \ --junit-xml=results.${osrel}.py${pyversion}.xml \ @@ -52,7 +52,7 @@ py.test \ if [ $ret -ne 0 ]; then # we always exit 0, preferring instead the jUnit XML # results to be the dominate cause of a failed build. - echo "py.test returned exit code ${ret}." >&2 + echo "pytest returned exit code ${ret}." >&2 echo "the build should detect and report these failing tests." >&2 fi From ae982f67c7039373fdb5fded5f3c7e2644555930 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 11 Sep 2023 22:47:22 +0300 Subject: [PATCH 3/3] Only try to upload coverage for upstream --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b658f87a..d2fa22d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,7 @@ jobs: pytest --cov pexpect --cov-config .coveragerc - name: Check coverage + if: github.repository_owner == 'pexpect' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: |