Commit Graph

16086 Commits

Author SHA1 Message Date
Bruno Oliveira 201ed9f6a5 Update src/_pytest/reports.py 2024-07-01 13:23:53 +02:00
pre-commit-ci[bot] 2c1ed505d9 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-07-01 13:23:53 +02:00
Bruno Oliveira 269ded17a6 Update src/_pytest/reports.py 2024-07-01 13:23:53 +02:00
Pavel Březina 41ca4dd44e testresult: correctly apply verbose word markup and avoid crash
The following snippet would have resulted in crash on multiple places since
`_get_verbose_word` expects only string, not a tuple.

```python
    @pytest.hookimpl(tryfirst=True)
    def pytest_report_teststatus(report: pytest.CollectReport | pytest.TestReport, config: pytest.Config):
        if report.when == "call":
            return ("error", "A",  ("AVC", {"bold": True, "red": True}))

        return None
```

```
Traceback (most recent call last):
  File "/home/pbrezina/workspace/sssd/.venv/bin/pytest", line 8, in <module>
    sys.exit(console_main())
             ^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/config/__init__.py", line 207, in console_main
    code = main()
           ^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/config/__init__.py", line 179, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/main.py", line 333, in pytest_cmdline_main
    return wrap_session(config, _main)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/main.py", line 321, in wrap_session
    config.hook.pytest_sessionfinish(
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/logging.py", line 872, in pytest_sessionfinish
    return (yield)
            ^^^^^
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_callers.py", line 124, in _multicall
    teardown.send(result)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/terminal.py", line 899, in pytest_sessionfinish
    self.config.hook.pytest_terminal_summary(
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/home/pbrezina/workspace/sssd/.venv/lib64/python3.11/site-packages/pluggy/_callers.py", line 124, in _multicall
    teardown.send(result)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/terminal.py", line 923, in pytest_terminal_summary
    self.short_test_summary()
  File "/home/pbrezina/workspace/pytest/src/_pytest/terminal.py", line 1272, in short_test_summary
    action(lines)
  File "/home/pbrezina/workspace/pytest/src/_pytest/terminal.py", line 1205, in show_simple
    line = _get_line_with_reprcrash_message(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/terminal.py", line 1429, in _get_line_with_reprcrash_message
    word = tw.markup(verbose_word, **word_markup)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pbrezina/workspace/pytest/src/_pytest/_io/terminalwriter.py", line 114, in markup
    text = "".join(f"\x1b[{cod}m" for cod in esc) + text + "\x1b[0m"
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
TypeError: can only concatenate str (not "tuple") to str
```

Signed-off-by: Pavel Březina <pbrezina@redhat.com>
2024-07-01 13:23:53 +02:00
github-actions[bot] dbf7dee8c8
[automated] Update plugin list (#12547)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-06-30 12:05:11 +00:00
Zach Snicker 0adcc21f48
Support venv detection on Windows with mingw Python (#12545)
Closes #12544
2024-06-29 00:30:51 +03:00
joseph-sentry 0ed2d79457
junitxml: add timezone to testsuite timestamp (#12491)
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
Co-authored-by: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>
2024-06-27 09:41:02 -03:00
Sviatoslav Sydorenko (Святослав Сидоренко) f74e947c1f
Merge pull request #12533 from webknjaz/docs/drop-extlinks-bpo 2024-06-26 14:39:31 +02:00
Sviatoslav Sydorenko d75fa9f9b4
📝 Add a change note for PE #12533 2024-06-26 14:22:56 +02:00
Sviatoslav Sydorenko 29e4b6b9f0
📝🔥 Remove the `:bpo:` RST role declaration
BPO is in read-only mode and all issues have been migrated to GitHub.
This patch replaces the use of that role with `:issue:`, recently
integrated via #12522. It also disables the built-in `extlinks` Sphinx
extension, as it's no longer in use.
2024-06-26 14:19:13 +02:00
Florian Bruhin 53bf188999
Merge pull request #12523 from lovetheguitar/fix/follow_up_to_pr_#12500
Improve documentation & other kinks of marker keyword expression PR #12500
2024-06-25 10:17:07 +02:00
lovetheguitar 36b384afc7 docs(expression.py): simplify grammar documentation by defining `kwargs` separately 2024-06-25 09:18:18 +02:00
lovetheguitar 3d07791c36 chore: remove obsolete `TODO`s 2024-06-25 09:18:18 +02:00
lovetheguitar dd57196953 perf(expression): define `TokenType.STRING` as "string literal" for clearer errors 2024-06-25 09:18:18 +02:00
lovetheguitar 540ede3439 docs(expression.py): describe new `name` & `value` productions 2024-06-25 09:18:18 +02:00
Florian Bruhin 2b7eadf090
Update trainings (#12514) 2024-06-25 07:24:50 +02:00
pre-commit-ci[bot] 77416d64f5
[pre-commit.ci] pre-commit autoupdate (#12528)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.9 → v0.4.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.9...v0.4.10)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-25 04:26:26 +00:00
dependabot[bot] d582dcfc16
build(deps): Bump peter-evans/create-pull-request from 6.0.5 to 6.1.0 (#12527)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.5 to 6.1.0.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](6d6857d369...c5a7806660)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-24 18:21:02 -03:00
Sviatoslav Sydorenko (Святослав Сидоренко) 237152552e
Merge pull request #12522 from webknjaz/docs/sphinx-issues-ext
📝 Replace GH/PyPI `extlinks` w/ `sphinx-issues`
2024-06-23 16:55:51 +02:00
github-actions[bot] 175340e06b
[automated] Update plugin list (#12524)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-06-23 06:22:44 +00:00
Sviatoslav Sydorenko 8f2ef30f4a
🚑 Stop setting PR/issue prefix @ `sphinx-issues`
Apparently, the extension only supports one of the pre-defined
prefixes.
2024-06-22 22:16:40 +02:00
Sviatoslav Sydorenko 0971a95902
📝 Add a change note for PR #12522 2024-06-22 22:14:33 +02:00
Sviatoslav Sydorenko b919a711a4
📝 Replace GH/PyPI `extlinks` w/ `sphinx_issues`
This extension implements more generic roles that can also be used
more flexibly. Relying on an external extension allows to stop
maintaining an in-repo copy of the commonly used behavior.
2024-06-22 22:11:43 +02:00
Sviatoslav Sydorenko 66dbab697b
📝 Rename `:pull:` RST role to `:pr:`
This is a preparatory patch for integrating the third party
`sphinx-issues` extension.
2024-06-22 21:54:45 +02:00
lovetheguitar 3cce243774 docs(expression.py): fix typo 2024-06-22 20:16:24 +02:00
lovetheguitar 73bc35ce2b docs(expression.py): correct grammar definition of lexer 2024-06-22 20:16:24 +02:00
lovetheguitar 66eff85e54 docs: use double quotes for cross-platform compatibility in example code 2024-06-22 19:48:15 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко) f75e3fe63f
Merge pull request #12516 from webknjaz/maintenance/hotfix/gha-codecov-token 2024-06-22 12:32:18 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко) 6448d30fa1
Merge pull request #12517 from webknjaz/maintenance/gha-check-223e4bb7 2024-06-22 11:58:41 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко) fbdf9c887c
Merge pull request #12455 from stdedos/patch-1
Update `contact.rst`: Update Matrix link
2024-06-21 23:26:32 +02:00
Sviatoslav Sydorenko c716e0baef
🧪 Bump the `alls-green` action to 223erbb7
This version drops the use of the outdated GHA syntax for setting
action output values.
2024-06-21 23:06:26 +02:00
Sviatoslav Sydorenko 1b85ac126e
🚑🧪 Set the Codecov token directly in GHA
It's necessary since it seems that the currently used Codecov uploader
doesn't read the token from config sometimes.

This is a follow-up for #12508 which wasn't enough.
2024-06-21 22:52:17 +02:00
Ronny Pfannschmidt 9f134fc6ad
Merge pull request #12500 from lovetheguitar/feat/support_marker_kwarg_in_marker_expressions 2024-06-21 22:24:34 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко) 75a2225ed1
🔥 Drop the missing kwargs case 2024-06-21 22:09:45 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко) 329662e2ec
📝 Drop stray trailing period from the change note byline 2024-06-21 22:06:33 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко) 24450e33e3
📝 Use explicit RST roles for built-in types in docs 2024-06-21 22:05:43 +02:00
lovetheguitar b1255a9aae style(mark): type hint `**kwargs` as `str | int | bool | None` 2024-06-21 20:51:01 +02:00
lovetheguitar c3e898353b docs(AUTHORS): add myself as contributor 2024-06-21 20:51:01 +02:00
lovetheguitar 9cf9cfabcb docs(12281.feature.rst): add changelog fragment 2024-06-21 20:51:01 +02:00
lovetheguitar 598d881c9c docs: document keyword argument support in marker expressions 2024-06-21 20:51:01 +02:00
lovetheguitar 7c7c36d7e0 test(test_mark.py): add sad case that `-k` doesn't support keyword expressions 2024-06-21 20:51:01 +02:00
lovetheguitar 3921d94316 test: use new `MarkMatcher.from_markers` method & register test markers 2024-06-21 20:51:01 +02:00
lovetheguitar 6dd8ad60a4 refactor(MarkMatcher): replace `from_item` with `from_markers` method 2024-06-21 20:51:01 +02:00
lovetheguitar 1e7eb20347 perf(expression): improve string lexing & error messages 2024-06-21 20:51:01 +02:00
lovetheguitar f4897391ec refactor(mark): use existing `NOT_SET` sentinel 2024-06-21 20:51:01 +02:00
lovetheguitar 1cc35ecc3f test: add empty string keyword argument marker test cases 2024-06-21 20:51:01 +02:00
lovetheguitar 04f457c4f4 style: use `@overload` to get rid of mypy only assertions 2024-06-21 20:51:01 +02:00
lovetheguitar 15c33fbaa3 feat: support keyword arguments in marker expressions
Fixes #12281
2024-06-21 20:51:01 +02:00
Ronny Pfannschmidt e8fa8dd31c
Merge pull request #12509 from pytest-dev/update-plugin-list/patch-c8948fca6
[automated] Update plugin list
2024-06-21 20:34:00 +02:00
pytest bot 27b2550283 [automated] Update plugin list 2024-06-21 20:19:10 +02:00