Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/add_multiline_error_strings' int…
Browse files Browse the repository at this point in the history
…o add_multiline_error_strings
  • Loading branch information
helpmefindaname committed May 19, 2023
2 parents 1b3e1f6 + d4ccb2d commit a0a74de
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 32 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python 3.7
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: '3.11'

- name: Install dependencies for build
run: pip install --upgrade setuptools wheel
run: pip install --upgrade setuptools build

- name: Build
run: python setup.py sdist bdist_wheel
run: python -m build

- name: Publish package
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
15 changes: 6 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: "v4.4.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -12,17 +12,14 @@ repos:
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: fix-encoding-pragma

- repo: https://github.com/mgedmin/check-manifest
rev: "0.42"
rev: "0.49"
hooks:
- id: check-manifest

- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.262"
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-import-order
- id: ruff
args: ["--fix", "--show-fixes"]
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.2.0 (2023-05-04)

### Incompatible changes

- Require python 3.7+ #66 (thanks to @ssbarnea)

### Other changes

- Fix publish package workflow #74
- Handle cases where pytest itself fails #70 (thanks to @edgarrmondragon)
- Adopt PEP-621 for packaging #65 (thanks to @ssbarnea)
- Bump pre-commit/action from 2.0.0 to 3.0.0 #56

## 0.1.8 (2022-12-20)

No functionality change.
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include *.py
include *.txt
include *.yaml
include .flake8
include .pre-commit-config.yaml
include CHANGELOG.md
include LICENSE
Expand Down
7 changes: 3 additions & 4 deletions plugin_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
import os
from __future__ import annotations

from packaging import version
import os

import pytest

from packaging import version

pytest_plugins = "pytester"

Expand Down
40 changes: 39 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
[project]
# https://peps.python.org/pep-0621/#readme
requires-python = ">=3.7"
version = "0.1.8"
version = "0.2.0"
name = "pytest-github-actions-annotate-failures"
description = "pytest plugin to annotate failed tests with a workflow command for GitHub Actions"
readme = "README.md"
Expand Down Expand Up @@ -49,3 +49,41 @@ changelog = "https://github.com/pytest-dev/pytest-github-actions-annotate-failur

[project.entry-points.pytest11]
pytest_github_actions_annotate_failures = "pytest_github_actions_annotate_failures.plugin"


[tool.ruff]
select = [
"E", "F", "W", # flake8
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"RET", # flake8-return
"RUF", # Ruff-specific
"SIM", # flake8-simplify
"UP", # pyupgrade
"YTT", # flake8-2020
"EXE", # flake8-executable
]
extend-ignore = [
"PLR", # Design related pylint codes
"E501", # Line too long
"PT004", # Use underscore for non-returning fixture (use usefixture instead)
]
target-version = "py37"
unfixable = [
"T20", # Removes print statements
"F841", # Removes unused variables
]
isort.required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
"tests/**" = ["T20"]
16 changes: 7 additions & 9 deletions pytest_github_actions_annotate_failures/plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-

from __future__ import annotations

Expand All @@ -8,9 +7,8 @@
from collections import OrderedDict
from typing import TYPE_CHECKING

from _pytest._code.code import ExceptionRepr

import pytest
from _pytest._code.code import ExceptionRepr

if TYPE_CHECKING:
from _pytest.nodes import Item
Expand All @@ -27,7 +25,7 @@


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

details = ",".join("{}={}".format(k, v) for k, v in details_dict.items())
details = ",".join(f"{k}={v}" for k, v in details_dict.items())

if longrepr is None:
return "\n::error {}".format(details)
else:
longrepr = _escape(longrepr)
return "\n::error {}::{}".format(details, longrepr)
return f"\n::error {details}"

longrepr = _escape(longrepr)
return f"\n::error {details}::{longrepr}"


def _escape(s):
Expand Down

0 comments on commit a0a74de

Please sign in to comment.