Skip to content

Commit 65c142a

Browse files
authored
Merge pull request #91 from nicoddemus/modernize-workflows
Drop Python 3.8 and modernize workflows
2 parents 5f0f046 + 75fa378 commit 65c142a

13 files changed

+163
-97
lines changed

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
time: "03:00"
8+
open-pull-requests-limit: 10

.github/workflows/deploy.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
9+
default: '1.2.3'
10+
11+
jobs:
12+
13+
package:
14+
runs-on: ubuntu-latest
15+
env:
16+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Build and Check Package
22+
uses: hynek/[email protected]
23+
24+
deploy:
25+
needs: package
26+
runs-on: ubuntu-latest
27+
environment: deploy
28+
permissions:
29+
id-token: write # For PyPI trusted publishers.
30+
contents: write # For tag.
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Download Package
36+
uses: actions/download-artifact@v4
37+
with:
38+
name: Packages
39+
path: dist
40+
41+
- name: Publish package to PyPI
42+
uses: pypa/[email protected]
43+
with:
44+
attestations: true
45+
46+
- name: GitHub Release
47+
env:
48+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
run: |
50+
gh release create v${{ github.event.inputs.version }} --target=${{ github.ref_name }} --title v${{ github.event.inputs.version }}
51+
gh pr merge ${{ github.ref_name }} --merge

.github/workflows/publish.yml

-42
This file was deleted.

.github/workflows/test.yml

+45-17
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,58 @@ name: test
22

33
on:
44
push:
5+
branches:
6+
- main
7+
- "test-me-*"
8+
59
pull_request:
6-
workflow_call:
10+
branches:
11+
- "*"
12+
13+
14+
# Cancel running jobs for the same workflow and branch.
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
718

819
jobs:
20+
21+
package:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Build and Check Package
26+
uses: hynek/[email protected]
27+
928
test:
29+
needs: [package]
1030
runs-on: ${{ matrix.os }}
11-
1231
strategy:
1332
fail-fast: false
1433
matrix:
15-
python-version:
16-
["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8"]
17-
os: [ubuntu-latest, windows-latest, macos-latest]
34+
os: ["ubuntu-latest", "windows-latest"]
35+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1836

1937
steps:
20-
- uses: actions/checkout@v4
21-
- name: Set up Python
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: ${{ matrix.python-version }}
25-
- name: Install dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
python -m pip install tox
29-
- name: Test
30-
run: |
31-
tox -e py
38+
- uses: actions/checkout@v4
39+
40+
- name: Download Package
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: Packages
44+
path: dist
45+
46+
- name: Set up Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: ${{ matrix.python }}
50+
51+
- name: Install tox
52+
run: |
53+
python -m pip install --upgrade pip
54+
python -m pip install --upgrade tox
55+
56+
- name: Test
57+
shell: bash
58+
run: |
59+
tox run -e py --installpkg `find dist/*.tar.gz`

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121

2222
### Added
2323

24+
- Confirmed Python 3.13 support. ([#91])
2425
- Confirmed Python 3.12 support. ([#84])
2526
- Added `CHANGELOG.md` file. ([#40])
2627
- Confirmed Python 3.11 support. ([#39])
@@ -32,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3233
### Removed
3334

3435
- Dropped Python 3.7 support. ([#84])
36+
- Dropped Python 3.8 support. ([#91])
3537

3638

3739
## [0.1.1] - 2022-03-03
@@ -55,3 +57,4 @@ Initial release!
5557
[#65]: https://github.com/nicoddemus/pytest-rich/pull/65
5658
[#66]: https://github.com/nicoddemus/pytest-rich/pull/66
5759
[#84]: https://github.com/nicoddemus/pytest-rich/pull/84
60+
[#91]: https://github.com/nicoddemus/pytest-rich/pull/91

RELEASING.rst

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
=========================
2+
Releasing pytest-rich
3+
=========================
4+
5+
This document describes the steps to make a new ``pytest-rich`` release.
6+
7+
Version
8+
-------
9+
10+
``master`` should always be green and a potential release candidate. ``pytest-rich`` follows
11+
semantic versioning, so given that the current version is ``X.Y.Z``, to find the next version number
12+
one needs to look at the ``CHANGELOG.rst`` file:
13+
14+
- If there any new feature, then we must make a new **minor** release: next
15+
release will be ``X.Y+1.0``.
16+
17+
- Otherwise it is just a **bug fix** release: ``X.Y.Z+1``.
18+
19+
20+
Steps
21+
-----
22+
23+
To publish a new release ``X.Y.Z``, the steps are as follows:
24+
25+
#. Create a new branch named ``release-X.Y.Z`` from the latest ``main``.
26+
27+
#. Update the ``CHANGELOG.rst`` file with the new release information.
28+
29+
#. Commit and push the branch to ``upstream`` and open a PR.
30+
31+
#. Once the PR is **green** and **approved**, start the ``deploy`` workflow:
32+
33+
.. code-block:: console
34+
35+
gh workflow run deploy.yml -R pytest-dev/pytest-rich --ref release-VERSION --field version=VERSION
36+
37+
The PR will be automatically merged.

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
requires = [
33
"setuptools>=42",
44
"setuptools-scm",
5-
"wheel"
65
]
76
build-backend = "setuptools.build_meta"
87

setup.cfg

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@ license = MIT
88
url = https://github.com/nicoddemus/pytest-rich
99
description = Leverage rich for richer test session output
1010
long_description = file: README.rst
11+
long_description_content_type = text/x-rst
1112
classifiers =
1213
Development Status :: 4 - Beta
1314
Framework :: Pytest
1415
Intended Audience :: Developers
1516
Topic :: Software Development :: Testing
1617
Programming Language :: Python
1718
Programming Language :: Python :: 3
18-
Programming Language :: Python :: 3.8
1919
Programming Language :: Python :: 3.9
2020
Programming Language :: Python :: 3.10
2121
Programming Language :: Python :: 3.11
2222
Programming Language :: Python :: 3.12
23+
Programming Language :: Python :: 3.13
2324
Programming Language :: Python :: 3 :: Only
2425
Programming Language :: Python :: Implementation :: CPython
2526
Programming Language :: Python :: Implementation :: PyPy
@@ -31,12 +32,11 @@ package_dir=
3132
=src
3233
packages=find:
3334
py_modules = pytest_rich
34-
python_requires = >=3.7
35+
python_requires = >=3.9
3536
install_requires =
3637
attrs
3738
pytest >= 7.0
3839
rich
39-
typing_extensions; python_version < '3.8'
4040

4141
[options.extras_require]
4242
dev =

src/pytest_rich/capture.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from datetime import datetime
33
from datetime import timezone
44
from pathlib import Path
5-
from typing import Tuple
65

76
from rich.console import Console
87

@@ -28,7 +27,7 @@ def save_terminal_output(console: Console, arg: str) -> None:
2827
save_func(f"{filename}.{filetype}")
2928

3029

31-
def _get_filename_from_arg(arg: str) -> Tuple[str, str]:
30+
def _get_filename_from_arg(arg: str) -> tuple[str, str]:
3231
"""
3332
Get filename from command line argument.
3433

src/pytest_rich/header.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from typing import Iterable
2+
from collections.abc import Iterable
33
from typing import Union
44

55
import pytest

src/pytest_rich/terminal.py

+8-16
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import sys
21
import warnings
32
from collections import defaultdict
3+
from collections.abc import Sequence
44
from pathlib import Path
5-
from typing import Dict
6-
from typing import List
5+
from typing import Literal
76
from typing import Optional
8-
from typing import Sequence
9-
from typing import Tuple
107
from typing import Union
118

129
import attr
@@ -28,11 +25,6 @@
2825
from pytest_rich.header import generate_header_panel
2926
from pytest_rich.traceback import RichExceptionChainRepr
3027

31-
if sys.version_info < (3, 8):
32-
from typing_extensions import Literal
33-
else:
34-
from typing import Literal
35-
3628
HORIZONTAL_PAD = (0, 1, 0, 1)
3729

3830

@@ -48,11 +40,11 @@ def __attrs_post_init__(self):
4840
self.runtest_progress: Optional[Progress] = None
4941
self.total_items_collected = 0
5042
self.total_items_completed = 0
51-
self.items_per_file: Dict[Path, List[pytest.Item]] = {}
52-
self.status_per_item: Dict[str, RichTerminalReporter.Status] = {}
53-
self.items: Dict[str, pytest.Item] = {}
54-
self.runtest_tasks_per_file: Dict[Path, TaskID] = {}
55-
self.categorized_reports: Dict[str, List[pytest.TestReport]] = defaultdict(list)
43+
self.items_per_file: dict[Path, list[pytest.Item]] = {}
44+
self.status_per_item: dict[str, RichTerminalReporter.Status] = {}
45+
self.items: dict[str, pytest.Item] = {}
46+
self.runtest_tasks_per_file: dict[Path, TaskID] = {}
47+
self.categorized_reports: dict[str, list[pytest.TestReport]] = defaultdict(list)
5648
self.summary: Optional[Live] = None
5749
self.total_duration: float = 0
5850
self.console.record = self.config.getoption("rich_capture") is not None
@@ -114,7 +106,7 @@ def pytest_deselected(self, items: Sequence[pytest.Item]) -> None: ...
114106
def pytest_plugin_registered(self, plugin) -> None: ...
115107

116108
def pytest_runtest_logstart(
117-
self, nodeid: str, location: Tuple[str, Optional[int], str]
109+
self, nodeid: str, location: tuple[str, Optional[int], str]
118110
) -> None:
119111
if self.runtest_progress is None:
120112
self.runtest_progress = Progress(SpinnerColumn(), "{task.description}")

0 commit comments

Comments
 (0)