From ed9c8885417fb7b62132bb2d257c33f1ddf70600 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 11 Jan 2024 11:40:08 -0300 Subject: [PATCH 1/5] Rename main workflow to test --- .github/workflows/{main.yml => test.yml} | 4 ++-- README.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{main.yml => test.yml} (98%) diff --git a/.github/workflows/main.yml b/.github/workflows/test.yml similarity index 98% rename from .github/workflows/main.yml rename to .github/workflows/test.yml index 544da87..83aeffc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,9 @@ -name: build +name: test on: [push, pull_request] jobs: - build: + test: runs-on: ${{ matrix.os }} diff --git a/README.rst b/README.rst index 0725ac6..b1cf708 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ pytest-replay .. image:: https://anaconda.org/conda-forge/pytest-replay/badges/version.svg :target: https://anaconda.org/conda-forge/pytest-replay -.. image:: https://github.com/ESSS/pytest-replay/workflows/build/badge.svg - :target: https://github.com/ESSS/pytest-replay/actions?query=workflow%3Abuild +.. image:: https://github.com/ESSS/pytest-replay/workflows/test/badge.svg + :target: https://github.com/ESSS/pytest-replay/actions?query=workflow%3Atest .. image:: https://img.shields.io/pypi/pyversions/pytest-replay.svg :target: https://pypi.python.org/pypi/pytest-replay From 666aba3577e9249292f2e8ae345b769d7c551c2a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 11 Jan 2024 11:50:09 -0300 Subject: [PATCH 2/5] Separate deploy into its own workflow --- .github/workflows/deploy.yml | 35 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 31 ++----------------------------- 2 files changed, 37 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..0cb0da9 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,35 @@ +name: deploy + +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + +jobs: + + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install build + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: | + python -m build + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@v1.8.11 + with: + user: __token__ + password: ${{ secrets.pypi_token }} + - name: Publish GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: dist/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 83aeffc..3cff688 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,9 +30,9 @@ jobs: os: "windows-latest" steps: - - 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: ${{ matrix.python }} - name: Install tox @@ -42,30 +42,3 @@ jobs: - name: Test run: | tox -e ${{ matrix.tox_env }} - - deploy: - - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - - runs-on: ubuntu-latest - - needs: build - - steps: - - uses: actions/checkout@v1 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: "3.7" - - name: Install wheel - run: | - python -m pip install --upgrade pip - pip install wheel - - name: Build package - run: | - python setup.py sdist bdist_wheel - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_token }} From 2035cf99226a3d43c54b57b79f40d717099ff93d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 11 Jan 2024 12:00:14 -0300 Subject: [PATCH 3/5] Drop Python 3.6 and 3.7, add CI for 3.10+ Also revamped our CI to build the package once and test many times, and publish GitHub release on deploy. --- .github/workflows/deploy.yml | 28 +++++++++++-------- .github/workflows/test.yml | 54 +++++++++++++++++++++++------------- .pre-commit-config.yaml | 1 - CHANGELOG.rst | 2 ++ setup.py | 20 ++++++------- tox.ini | 13 ++------- 6 files changed, 64 insertions(+), 54 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0cb0da9..420a784 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,28 +7,32 @@ on: jobs: - deploy: + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build and Check Package + uses: hynek/build-and-inspect-python-package@v1.5 + + deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + + - name: Download Package + uses: actions/download-artifact@v3 with: - python-version: "3.x" - - name: Install build - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: | - python -m build + name: Packages + path: dist + + - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@v1.8.11 with: user: __token__ password: ${{ secrets.pypi_token }} + - name: Publish GitHub Release uses: softprops/action-gh-release@v1 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3cff688..b831cc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,44 +1,60 @@ name: test -on: [push, pull_request] +on: + push: + branches: + - "master" + - "test-me-*" + + pull_request: + + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: + + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build and Check Package + uses: hynek/build-and-inspect-python-package@v1.5 + test: runs-on: ${{ matrix.os }} + needs: package + strategy: fail-fast: false matrix: - python: ["3.7", "3.8", "3.9"] + python: ["3.8", "3.9", "3.10", "3.11", "3.12"] os: [ubuntu-latest, windows-latest] - include: - - python: "3.6" - os: ubuntu-20.04 - tox_env: "py36" - - python: "3.6" - os: windows-latest - tox_env: "py36" - - python: "3.7" - tox_env: "py37" - - python: "3.8" - tox_env: "py38" - - python: "3.9" - tox_env: "py39" - exclude: - - python: "3.6" - os: "windows-latest" steps: - uses: actions/checkout@v4 + + - name: Download Package + uses: actions/download-artifact@v3 + with: + name: Packages + path: dist + - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + - name: Install tox run: | python -m pip install --upgrade pip pip install tox + - name: Test + shell: bash run: | - tox -e ${{ matrix.tox_env }} + tox run -e py --installpkg `find dist/*.tar.gz` diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d386003..b811ce6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,6 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: debug-statements - - id: flake8 - repo: https://github.com/asottile/reorder-python-imports rev: v3.12.0 hooks: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 35cd516..1cc3a2c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,8 @@ UNRELEASED ========== +* Dropped support for Python 3.6 and 3.7 (EOL). +* Added official support for Python 3.10, 3.11 and 3.12. * Test execution order using ``--replay`` now follows the recorded order, not the collection order, as was always intended (`#52`_). .. _`#52`: https://github.com/ESSS/pytest-replay/pull/53 diff --git a/setup.py b/setup.py index 2de12fe..ed6e0cd 100644 --- a/setup.py +++ b/setup.py @@ -13,36 +13,34 @@ def read(fname): setup( name="pytest-replay", - version="0.0.0", - author="Bruno Oliveira", + author="ESSS", author_email="foss@esss.co", - maintainer="Bruno Oliveira", - maintainer_email="bruno@esss.com.br", license="MIT", url="https://github.com/ESSS/pytest-replay", description="Saves previous test runs and allow re-execute previous pytest runs " "to reproduce crashes or flaky tests", long_description=read("README.rst"), + long_description_content_type="text/x-rst", packages=find_packages(where="src"), package_dir={"": "src"}, - install_requires=["pytest>=3.0.0"], + install_requires=["pytest"], use_scm_version=True, setup_requires=[ - "setuptools_scm; python_version>'3.6'", - "setuptools_scm <7.0; python_version=='3.6'", + "setuptools_scm", ], - python_requires=">=3.6", + python_requires=">=3.8", classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Framework :: Pytest", "Intended Audience :: Developers", "Topic :: Software Development :: Testing", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Operating System :: OS Independent", "License :: OSI Approved :: MIT License", diff --git a/tox.ini b/tox.ini index a019ace..a2d6651 100644 --- a/tox.ini +++ b/tox.ini @@ -1,19 +1,10 @@ [tox] -envlist = py36,py37,py38,py39,linting +envlist = py38,py39,py310,py311,py312 [testenv] deps = pytest-xdist commands = pytest {posargs:tests} -[testenv:linting] -skip_install = True -basepython = python3.7 -deps = pre-commit>=1.11.0 -commands = pre-commit run --all-files --show-diff-on-failure - -[flake8] -max-line-length = 100 - [pytest] -addopts = -ra +addopts = -ra --color=yes From 0465c7968d6687fb40ee4793e8069fa6173314ae Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 11 Jan 2024 12:06:39 -0300 Subject: [PATCH 4/5] Run pyupgrade --py38-plus --- .github/workflows/deploy.yml | 2 -- src/pytest_replay/__init__.py | 2 +- tests/test_replay.py | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 420a784..ddc949f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -19,14 +19,12 @@ jobs: runs-on: ubuntu-latest steps: - - name: Download Package uses: actions/download-artifact@v3 with: name: Packages path: dist - - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@v1.8.11 with: diff --git a/src/pytest_replay/__init__.py b/src/pytest_replay/__init__.py index cf6c371..93e4638 100644 --- a/src/pytest_replay/__init__.py +++ b/src/pytest_replay/__init__.py @@ -104,7 +104,7 @@ def pytest_collection_modifyitems(self, items, config): if not replay_file: return - with open(replay_file, "r", encoding="UTF-8") as f: + with open(replay_file, encoding="UTF-8") as f: all_lines = f.readlines() # Use a dict to deduplicate the node ids while keeping the order. nodeids = dict.fromkeys( diff --git a/tests/test_replay.py b/tests/test_replay.py index cebc6d2..6bb18b2 100644 --- a/tests/test_replay.py +++ b/tests/test_replay.py @@ -160,7 +160,7 @@ def test_alternate_serial_parallel_does_not_erase_runs(suite, testdir, reverse): for command_line in command_lines: result = testdir.runpytest_subprocess(*command_line) assert result.ret == 0 - assert set(x.basename for x in (testdir.tmpdir / "replay").listdir()) == { + assert {x.basename for x in (testdir.tmpdir / "replay").listdir()} == { ".pytest-replay.txt", ".pytest-replay-gw0.txt", ".pytest-replay-gw1.txt", @@ -186,7 +186,7 @@ def test_skip_cleanup_does_not_erase_replay_files(suite, testdir): for command_line in command_lines: result = testdir.runpytest_subprocess(*command_line) assert result.ret == 0 - assert set(x.basename for x in dir.listdir()) == { + assert {x.basename for x in dir.listdir()} == { ".pytest-replay-gw0.txt", ".pytest-replay-gw1.txt", } From 64c68077d8971ab0a6d3b0bef9449bbb862baa87 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 11 Jan 2024 14:06:06 -0300 Subject: [PATCH 5/5] Fix CHANGELOG and deploy --- .github/workflows/deploy.yml | 2 ++ CHANGELOG.rst | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ddc949f..0308ccd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,6 +18,8 @@ jobs: deploy: runs-on: ubuntu-latest + needs: package + steps: - name: Download Package uses: actions/download-artifact@v3 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1cc3a2c..9b4e4b3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -UNRELEASED -========== +1.5.1 (2024-01-11) +================== * Dropped support for Python 3.6 and 3.7 (EOL). * Added official support for Python 3.10, 3.11 and 3.12.