Skip to content

Commit a0a74de

Browse files
Merge remote-tracking branch 'origin/add_multiline_error_strings' into add_multiline_error_strings
2 parents 1b3e1f6 + d4ccb2d commit a0a74de

File tree

8 files changed

+73
-32
lines changed

8 files changed

+73
-32
lines changed

.flake8

-3
This file was deleted.

.github/workflows/deploy.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ jobs:
1212
- name: Checkout
1313
uses: actions/checkout@v3
1414

15-
- name: Set up Python 3.7
15+
- name: Set up Python
1616
uses: actions/setup-python@v4
1717
with:
18-
python-version: 3.7
18+
python-version: '3.11'
1919

2020
- name: Install dependencies for build
21-
run: pip install --upgrade setuptools wheel
21+
run: pip install --upgrade setuptools build
2222

2323
- name: Build
24-
run: python setup.py sdist bdist_wheel
24+
run: python -m build
2525

2626
- name: Publish package
27-
uses: pypa/gh-action-pypi-publish@master
27+
uses: pypa/gh-action-pypi-publish@release/v1
2828
with:
2929
user: __token__
3030
password: ${{ secrets.pypi_password }}

.pre-commit-config.yaml

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v3.1.0
3+
rev: "v4.4.0"
44
hooks:
55
- id: check-added-large-files
66
- id: check-case-conflict
@@ -12,17 +12,14 @@ repos:
1212
- id: mixed-line-ending
1313
- id: requirements-txt-fixer
1414
- id: trailing-whitespace
15-
- id: fix-encoding-pragma
1615

1716
- repo: https://github.com/mgedmin/check-manifest
18-
rev: "0.42"
17+
rev: "0.49"
1918
hooks:
2019
- id: check-manifest
2120

22-
- repo: https://github.com/PyCQA/flake8
23-
rev: 3.8.3
21+
- repo: https://github.com/charliermarsh/ruff-pre-commit
22+
rev: "v0.0.262"
2423
hooks:
25-
- id: flake8
26-
additional_dependencies:
27-
- flake8-bugbear
28-
- flake8-import-order
24+
- id: ruff
25+
args: ["--fix", "--show-fixes"]

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## 0.2.0 (2023-05-04)
4+
5+
### Incompatible changes
6+
7+
- Require python 3.7+ #66 (thanks to @ssbarnea)
8+
9+
### Other changes
10+
11+
- Fix publish package workflow #74
12+
- Handle cases where pytest itself fails #70 (thanks to @edgarrmondragon)
13+
- Adopt PEP-621 for packaging #65 (thanks to @ssbarnea)
14+
- Bump pre-commit/action from 2.0.0 to 3.0.0 #56
15+
316
## 0.1.8 (2022-12-20)
417

518
No functionality change.

MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
include *.py
22
include *.txt
33
include *.yaml
4-
include .flake8
54
include .pre-commit-config.yaml
65
include CHANGELOG.md
76
include LICENSE

plugin_test.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# -*- coding: utf-8 -*-
2-
import os
1+
from __future__ import annotations
32

4-
from packaging import version
3+
import os
54

65
import pytest
7-
6+
from packaging import version
87

98
pytest_plugins = "pytester"
109

pyproject.toml

+39-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
99
[project]
1010
# https://peps.python.org/pep-0621/#readme
1111
requires-python = ">=3.7"
12-
version = "0.1.8"
12+
version = "0.2.0"
1313
name = "pytest-github-actions-annotate-failures"
1414
description = "pytest plugin to annotate failed tests with a workflow command for GitHub Actions"
1515
readme = "README.md"
@@ -49,3 +49,41 @@ changelog = "https://github.com/pytest-dev/pytest-github-actions-annotate-failur
4949

5050
[project.entry-points.pytest11]
5151
pytest_github_actions_annotate_failures = "pytest_github_actions_annotate_failures.plugin"
52+
53+
54+
[tool.ruff]
55+
select = [
56+
"E", "F", "W", # flake8
57+
"B", # flake8-bugbear
58+
"I", # isort
59+
"ARG", # flake8-unused-arguments
60+
"C4", # flake8-comprehensions
61+
"EM", # flake8-errmsg
62+
"ICN", # flake8-import-conventions
63+
"ISC", # flake8-implicit-str-concat
64+
"G", # flake8-logging-format
65+
"PGH", # pygrep-hooks
66+
"PIE", # flake8-pie
67+
"PL", # pylint
68+
"PT", # flake8-pytest-style
69+
"RET", # flake8-return
70+
"RUF", # Ruff-specific
71+
"SIM", # flake8-simplify
72+
"UP", # pyupgrade
73+
"YTT", # flake8-2020
74+
"EXE", # flake8-executable
75+
]
76+
extend-ignore = [
77+
"PLR", # Design related pylint codes
78+
"E501", # Line too long
79+
"PT004", # Use underscore for non-returning fixture (use usefixture instead)
80+
]
81+
target-version = "py37"
82+
unfixable = [
83+
"T20", # Removes print statements
84+
"F841", # Removes unused variables
85+
]
86+
isort.required-imports = ["from __future__ import annotations"]
87+
88+
[tool.ruff.per-file-ignores]
89+
"tests/**" = ["T20"]

pytest_github_actions_annotate_failures/plugin.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21

32
from __future__ import annotations
43

@@ -8,9 +7,8 @@
87
from collections import OrderedDict
98
from typing import TYPE_CHECKING
109

11-
from _pytest._code.code import ExceptionRepr
12-
1310
import pytest
11+
from _pytest._code.code import ExceptionRepr
1412

1513
if TYPE_CHECKING:
1614
from _pytest.nodes import Item
@@ -27,7 +25,7 @@
2725

2826

2927
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
30-
def pytest_runtest_makereport(item: Item, call):
28+
def pytest_runtest_makereport(item: Item, call): # noqa: ARG001
3129
# execute all other hooks to obtain the report object
3230
outcome = yield
3331
report: CollectReport = outcome.get_result()
@@ -124,13 +122,13 @@ def _error_workflow_command(filesystempath, lineno, longrepr):
124122
if lineno is not None:
125123
details_dict["line"] = lineno
126124

127-
details = ",".join("{}={}".format(k, v) for k, v in details_dict.items())
125+
details = ",".join(f"{k}={v}" for k, v in details_dict.items())
128126

129127
if longrepr is None:
130-
return "\n::error {}".format(details)
131-
else:
132-
longrepr = _escape(longrepr)
133-
return "\n::error {}::{}".format(details, longrepr)
128+
return f"\n::error {details}"
129+
130+
longrepr = _escape(longrepr)
131+
return f"\n::error {details}::{longrepr}"
134132

135133

136134
def _escape(s):

0 commit comments

Comments
 (0)