Compare commits

...

2335 Commits

Author SHA1 Message Date
Sviatoslav Sydorenko (Святослав Сидоренко)
ac41898755 Merge pull request #12563 from webknjaz/maintenance/hotfixes/note/12264--reraise-with-original-tb
📝🚑 Polish the PR #12264 changelog entry
2024-07-02 21:30:19 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
07ed62ae27 Merge pull request #12561 from webknjaz/maintenance/hotfixes/note/12502--ci-plugin-update-draft-ux
📝💄 Drop trailing period from #12502 byline
2024-07-02 21:28:41 +02:00
Virendra Patil
49bb5c89a6 Improved handling of invalid regex pattern in pytest.raises (#12526) 2024-07-02 21:58:08 +03:00
Sviatoslav Sydorenko (Святослав Сидоренко)
e8aee21384 Merge pull request #12562 from webknjaz/maintenance/docs/user-role-validation 2024-07-02 20:52:05 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
4a75f65c73 Merge pull request #12560 from webknjaz/maintenance/hotfixes/note/12531--xfail-no-cover 2024-07-02 20:50:16 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
2719fd6825 Merge pull request #12559 from webknjaz/maintenance/hotfixes/note/12545--venv-detection-mingw 2024-07-02 20:49:57 +02:00
Sviatoslav Sydorenko
b62974e63f 📝💅 Link #12264 change note to #12204 2024-07-02 15:54:35 +02:00
Sviatoslav Sydorenko
ffcc001562 📝 Add a byline to #12264 change note 2024-07-02 15:54:35 +02:00
Sviatoslav Sydorenko
94c0122a17 📝 Use past tense in #12204 change note 2024-07-02 15:54:34 +02:00
Sviatoslav Sydorenko
8398609f08 📝🚑 Fix RST list in #12264 changelog entry
It was being rendered inline and now it's not.
2024-07-02 15:54:34 +02:00
Sviatoslav Sydorenko
57fe9f53c6 📝 Add a change note for PR #12562 2024-07-02 15:26:35 +02:00
Sviatoslav Sydorenko
9c319d6605 🧪 Lint for typos in :user: RST role
It is easy to forget backticks in change note bylines. It's happened
in #12531 already, requiring a hotfix in #12560.

The pre-commit based check idea is coming from the Tox project and
have been battle-tested in aiohttp, CherryPy, and other ecosystems.
2024-07-02 15:21:24 +02:00
Sviatoslav Sydorenko
a34f2f06db 📝💄 Drop trailing period from #12502 byline 2024-07-02 15:15:31 +02:00
Sviatoslav Sydorenko
388cf8f381 Correct the :user: role @ PR #12531 change note 2024-07-02 15:12:27 +02:00
Sviatoslav Sydorenko
2455e99ea3 📝 Add markup to the PR #12545 changelog entry 2024-07-02 15:09:32 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
51ee3880c7 Merge pull request #12553 from pytest-dev/revert-12516-maintenance/hotfix/gha-codecov-token 2024-07-01 17:20:45 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
90459a8fd3 Merge pull request #12472 from pbrezina/testresult-markup 2024-07-01 17:06:07 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
de4e3cffc2 Revert "🚑🧪 Set the Codecov token directly in GHA" 2024-07-01 16:47:47 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
1a8394ed89 Merge pull request #12531 from webknjaz/maintenance/xfail-no-cover 2024-07-01 16:21:35 +02:00
Bruno Oliveira
f502f1db31 Update src/_pytest/reports.py 2024-07-01 13:23:53 +02:00
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
Sviatoslav Sydorenko
f2acc65485 📝 Add a change note for PR #12531 2024-06-25 23:33:43 +02:00
Sviatoslav Sydorenko
634a83df94 🧪 Unmeasure xfail tests
These tests are known to only be executed partially or not at all. So
we always get incomplete, missing, and sometimes flaky, coverage in
the test functions that are expected to fail.

This change updates the ``coverage.py`` config to prevent said tests
from influencing the coverage level measurement.
2024-06-25 23:25:04 +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 TODOs 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
Farbod Ahmadian
34e28295a7 refactor: simplify bound method representation (#12492)
Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
Co-authored-by: Farbod Ahmadian <farbod@datachef.com>
2024-06-21 18:20:44 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
9947ec3ad1 🧪🚑 Pass a Codecov config to the action @ GHA (#12508)
The #11921 update broke uploading coverage of the `main` branch (or
any in-repo pushes for that matter) to Codecov 4 months ago.
Version 4 requires an upload token to be provided and since there was
no configuration for it, the upload was failing. But the step itself
was showing up as successful due to `fail_ci_if_error: true` being
set. The error is visible in the console output, though.

This patch flips the setting to `fail_ci_if_error: false` and sets the
Codecov upload token in the config in clear text. The non-secret part
allows the PRs uploads to be more stable.

Co-authored-by: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>
2024-06-21 17:47:23 +02:00
Ronny Pfannschmidt
c8948fca65 Merge pull request #12502 from webknjaz/maintenance/ci-plugin-update-draft-ux
🧪 Make a draft based plugin bump PR CI trigger
2024-06-21 15:48:49 +02:00
Ronny Pfannschmidt
dab29d39d7 Merge pull request #12507 from webknjaz/maintenance/hotfixes/note/sphinx-towncrier-draft
📝 Add a change note for PR #12493
2024-06-21 15:26:11 +02:00
Oliver Bestwalter
b864e50138 Merge pull request #12498 from webknjaz/maintenance/tox-descriptions 2024-06-21 15:17:40 +02:00
Sviatoslav Sydorenko
5d95f09b2a 📝 Add a change note for PR #12493 2024-06-21 15:11:12 +02:00
Sviatoslav Sydorenko
a67327ac8e 📝 Add a change note to PR #12498 2024-06-21 14:14:28 +02:00
Sviatoslav Sydorenko
a69230ea5f 🎨 Add descriptions to all tox environments
Previously, a part of the environments weren't documented in the
config, making it difficult for the newbies to figure out what
their purposes are. This patch sets the descriptions for all the
envs listed with the `tox -av` command, leveraging the dynamic
factor-dependent explanation fragments.

```console
default environments:
linting                   -> run pre-commit-defined linters under `python3`
py38                      -> run the tests under `py38`
py39                      -> run the tests under `py39`
py310                     -> run the tests under `py310`
py311                     -> run the tests under `py311`
py312                     -> run the tests under `py312`
py313                     -> run the tests under `py313`
pypy3                     -> run the tests under `pypy3`
py38-pexpect              -> run the tests against `pexpect` under `py38`
py38-xdist                -> run the tests with pytest in parallel mode under `py38`
py38-unittestextras       -> run the tests against the unit test extras under `py38`
py38-numpy                -> run the tests against `numpy` under `py38`
py38-pluggymain           -> run the tests against the bleeding edge `pluggy` from Git under `py38`
py38-pylib                -> run the tests against `py` lib under `py38`
doctesting                -> run the tests under `~/.pyenv/versions/3.12.3/envs/pytest-pyenv-py3.12.3/bin/python` including doctests
doctesting-coverage       -> run the tests collecting coverage under `~/.pyenv/versions/3.12.3/envs/pytest-pyenv-py3.12.3/bin/python` including doctests
plugins                   -> run reverse dependency testing against pytest plugins under `~/.pyenv/versions/3.12.3/envs/pytest-pyenv-py3.12.3/bin/python`
py38-freeze               -> test pytest frozen with `pyinstaller` under `py38`
docs                      -> build the documentation site under `~/src/github/pytest-dev/pytest/doc/en/_build/html` with `python3`
docs-checklinks           -> check the links in the documentation with `python3`
py311-exceptiongroup      -> run the tests against `exceptiongroup` under `py311`

additional environments:
regen                     -> regenerate documentation examples under `python3`
release                   -> do a release, required posarg of the version number
prepare-release-pr        -> prepare a release PR from a manual trigger in GitHub actions
generate-gh-release-notes -> generate release notes that can be published as GitHub Release
nobyte                    -> run the tests in no-bytecode mode under `~/.pyenv/versions/3.12.3/envs/pytest-pyenv-py3.12.3/bin/python`
lsof                      -> run the tests with `--lsof` pytest CLI option under `~/.pyenv/versions/3.12.3/envs/pytest-pyenv-py3.12.3/bin/python`
```
2024-06-21 14:14:26 +02:00
Sviatoslav Sydorenko
072cb5250e 📝 Add a change note for PR #12502 2024-06-21 14:11:07 +02:00
Sviatoslav Sydorenko
323b0bd853 🧪 Make a draft based plugin bump PR CI trigger
Normally, PRs/commits published using the default GitHub Actions CI/CD
API token are not propagated to any integrations. This patch marks the
plugin update PR as a draft and leaves a comment asking the maintainers to
mark it as ready for review in order to actually trigger a CI run.

This idea is found in GitHub's own repos:
* https://github.com/github/codeql-action/pull/2263#issuecomment-2078311173
* https://github.com/github/codeql-action/blob/4ebadbc7/.github/workflows/update-dependencies.yml#L38-L41
* https://github.com/github/codeql-action/pull/1868
* https://github.com/github/codeql-action/pull/679
2024-06-21 14:11:06 +02:00
Ronny Pfannschmidt
b08b6d122f Merge pull request #12501 from webknjaz/maintenance/changelog-categories
📝💅 Split trivial change log category into 3
2024-06-21 13:50:07 +02:00
Sviatoslav Sydorenko
e73db68642 📝 Add a change note for PR #12501 2024-06-21 13:35:47 +02:00
Sviatoslav Sydorenko
3ce1d658bd 🎨 Set up Git to only allow certain change notes 2024-06-21 13:35:47 +02:00
Sviatoslav Sydorenko
03be1ed8b1 📝💅 Split trivial change log category into 3
The new change note types are `packaging`, `contrib` and `misc`.
`packaging` is intended for the audience of downstream redistributors.
The `contrib` notes are meant to be documenting news affecting the
project contributors, their development, and processes.
Finally, `misc` is for things that don't fit anywhere but are still
desired to be documented for some reason.
2024-06-21 13:35:47 +02:00
Sviatoslav Sydorenko
45a89ec61f 📝 Extend change log title meanings
This patch makes them more verbose so that they are clearer to the
readers.
2024-06-21 13:34:38 +02:00
Sviatoslav Sydorenko
0cf92cfa4c 📝 Add comments to change note categories 2024-06-21 13:34:38 +02:00
Ronny Pfannschmidt
bbe6b4a218 Merge pull request #12467 from RonnyPfannschmidt/ronny/new-annotations-try-2
from __future__ import annotations + migrate
2024-06-21 10:24:56 +02:00
Oliver Bestwalter
2f92da9190 Merge pull request #12503 from webknjaz/maintenance/hotfixes/sphinx-towncrier-draft 2024-06-21 10:08:50 +02:00
Ronny Pfannschmidt
6a8e9ed43a fixup: Config.cache cannot be None 2024-06-21 09:42:24 +02:00
Sviatoslav Sydorenko
dc2568a683 🚑🧪📝 Stop capping Towncrier @ local docs builds
It is uncapped in RTD. Apparently, `tox -e docs` is not invoked in CI,
neither is it called in RTD, resulting in the regression having been
caught only in local development environments.

This is a follow-up for #12493.
2024-06-20 22:13:43 +02:00
Sviatoslav Sydorenko
43815b6fc2 🚑🧪📝 Allow invoking git in tox
It is called when building the docs. Apparently, `tox -e docs` is not
invoked in CI, neither is it called in RTD, resulting in the
regression having been caught only in local development environments.

This is a follow-up for #12493.
2024-06-20 22:13:43 +02:00
Ronny Pfannschmidt
f426c0b35a Merge pull request #12469 from webknjaz/maintenance/non-setuptools-entry-points
📝 Make "setuptools entrypoint" term generic
2024-06-20 11:31:13 +02:00
Ronny Pfannschmidt
85e451a2cc add changelog entry 2024-06-20 11:10:04 +02:00
Ronny Pfannschmidt
4e54f19be1 update tox:docs python to rtd python 2024-06-20 11:04:38 +02:00
Ronny Pfannschmidt
5e1649f59a resolve most sphinx lookup errors
add the extra sphinx annotations to refer to Path instances

add Path to nitpicky ignore
2024-06-20 11:04:33 +02:00
Ronny Pfannschmidt
b7c0295e1a use runtime union for EXCEPTION_OR_MORE 2024-06-20 11:03:07 +02:00
Ronny Pfannschmidt
9295f9ffff RFC: from __future__ import annotations + migrate 2024-06-20 11:03:03 +02:00
Sviatoslav Sydorenko
cb179472bb 📝 Add change notes for PR #12469 2024-06-20 11:01:10 +02:00
Sviatoslav Sydorenko
39b548e6ea 📝 Make "setuptools entrypoint" term generic
This feature grew out of `setuptools` but the modern interface for
extracting this information from the distribution package metadata
is `importlib.metadata`. So the patch attempts to reflect this in
the documentation messaging.

Refs:
* https://docs.python.org/3/library/importlib.metadata.html#entry-points
* https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata
* https://packaging.python.org/en/latest/specifications/entry-points/#entry-points
2024-06-20 11:01:10 +02:00
Ronny Pfannschmidt
20dd1d6738 Merge pull request #12493 from webknjaz/maintenance/sphinx-towncrier-draft
📝💅 Always render changelog draft @ Sphinx docs
2024-06-20 10:59:04 +02:00
Sviatoslav Sydorenko
e702079fd5 📝💅 Always render changelog draft @ Sphinx docs
The earlier implementation was generating a temporary file, when
the docs site was being built with `tox`. However, this was not
enabled in RTD and is hackish.
This patch integrates the `sphinxcontrib-towncrier` extension to
make it work in any environment where Sphinx docs are being built.
2024-06-20 10:44:32 +02:00
Ronny Pfannschmidt
63dfa4bb84 Merge pull request #12494 from webknjaz/maintenance/rtd-conf-name
📝 Rename the RTD config to canonical filename
2024-06-20 10:39:34 +02:00
Sviatoslav Sydorenko
0470c387a9 📝 Rename the RTD config to canonical filename
Previously, it was possible to use several different config file name
variants. However, there is one canonical name now and the others are
being deprecated [[1]].

[1]: https://docs.rtfd.io/en/stable/config-file/index.html
2024-06-20 10:22:17 +02:00
Ronny Pfannschmidt
57bc6df510 Merge pull request #12488 from webknjaz/maintenance/gha-check-allowed-failures
🧪 Make required CI jobs match branch protection
2024-06-19 12:42:36 +02:00
Sviatoslav Sydorenko
6a95bcaa58 🧪 Make required CI jobs match branch protection 2024-06-19 12:10:20 +02:00
Ronny Pfannschmidt
ff133f6baa Merge pull request #12486 from webknjaz/maintenance/rm-legacy-backport-gha-workflow
🔥 Exterminate legacy backport GHA workflow
2024-06-19 11:59:28 +02:00
Sviatoslav Sydorenko
bab3c2c291 📝 Add myself to the authors file 2024-06-19 11:31:55 +02:00
Ronny Pfannschmidt
08a39bf9b7 Merge pull request #11818 from RonnyPfannschmidt/ronny/issue-11797-approx-sequence-like
fix #11797: be more lenient on SequenceLike approx
2024-06-19 11:25:55 +02:00
Sviatoslav Sydorenko
19715bf313 🔥 Exterminate legacy backport GHA workflow
Previously, this workflow was being used to cherry-pick PRs made
against `main` into older stable branches. Now that #12475 integrated
the Patchback GitHub App, it's no longer needed as it's making
duplicate pull requests which don't even trigger CI runs automatically
due to #10354. So this patch removes said workflow to address the
problem.
2024-06-19 11:22:55 +02:00
Ronny Pfannschmidt
c46a3a9920 Merge pull request #12477 from webknjaz/maintenance/chronographer-config
💅 Add a config for the Chronographer GitHub App
2024-06-19 09:49:11 +02:00
Sviatoslav Sydorenko (Святослав Сидоренко)
d7b4010638 💅 Add a config for the Patchback GitHub App (#12475)
This patch prepares the project's backporting process to start being
handled by the Patchback GitHub App [[1]].

Ref #9384
Resolves #9385
Resolves #9553
Resolves #9554
Resolves #9555

[1]: https://github.com/apps/patchback
2024-06-19 00:41:33 +00:00
Sviatoslav Sydorenko
f479afc5c0 💅 Add a config for the Chronographer GitHub App
This app allows requiring changelog fragments to be included with
each pull request.
2024-06-19 00:40:11 +02:00
Ronny Pfannschmidt
ea87bd6302 Merge pull request #12476 from webknjaz/maintenance/rtd-latest-env
🧪 Bump RTD env to the latest LTS Ubuntu & Python
2024-06-19 00:18:12 +02:00
Sviatoslav Sydorenko
9e98b6db5b 🧪 Bump RTD env to the latest LTS Ubuntu & Python 2024-06-18 18:39:13 +02:00
Ronny Pfannschmidt
76f3f3da00 fix #11797: be more lenient on SequenceLike approx
this needs a validation as it allows partially implemented sequences
2024-06-18 17:01:24 +02:00
Ronny Pfannschmidt
dc65bb6a66 Merge pull request #10315 from webknjaz/maintenance/gha-check
Introduce a gate/check GHA job
2024-06-18 16:30:54 +02:00
pre-commit-ci[bot]
807d16abfd [pre-commit.ci] pre-commit autoupdate (#12470)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.8 → v0.4.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.8...v0.4.9)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-18 08:29:53 -03:00
Sviatoslav Sydorenko (Святослав Сидоренко)
49374ec7a0 🚑 Clarify patch condition for doctest finder hack (#12471)
There was a regression caused by #12431 that excluded the patch on
broken CPython patch version ranges 3.11.0–3.11.8 and 3.12.0–3.12.2.

This change fixes that by adjusting the patching conditional clause
to include said versions.

Closes #12430.

Co-authored-by: Florian Bruhin <me@the-compiler.org>
2024-06-18 09:21:25 +00:00
Sviatoslav Sydorenko (Святослав Сидоренко)
fe4961afae Modernize the skipped test_issue_9765 regression test (#12468)
* 🚑 Explicitly set encoding @ `subprocess.run()`

This invocation is present in the `test_issue_9765` regression test
that is always skipped unconditionally, resulting in the
`EncodingWarning` never manifesting itself in CI or development
environments of the contributors.

* Change `setup.py` call w/ `pip install` @ tests

Using this CLI interface has been deprecated in `setuptools` [[1]].

[1]: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html
2024-06-17 15:44:14 +00:00
dependabot[bot]
80b7657b2a build(deps): Bump pypa/gh-action-pypi-publish from 1.8.14 to 1.9.0 (#12464)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.14 to 1.9.0.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.14...v1.9.0)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  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-17 09:58:23 +02:00
github-actions[bot]
5037f8d114 [automated] Update plugin list (#12462)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-06-16 05:24:06 +00:00
neutraljump
2effd8cb2c Docs: clean up various documentation pages (#12451)
* Change Contribution doc title to match sidebar

* Rearrange sentence for clarity

* Update backwards-compatibility.rst

some minor grammar changes

* Update pythonpath.rst

fixed some gramatical errors

* Update AUTHORS

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update doc/en/explanation/pythonpath.rst

From a quick overview it looks like lowercase is more consistent, although some pages do use `pytest` in code blocks

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>

---------

Co-authored-by: Mackerello <82668740+Mackerello@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-06-13 09:09:02 -03:00
Stavros Ntentos
037aaa7d45 Update contact.rst: Update Matrix link 2024-06-13 11:18:40 +03:00
pre-commit-ci[bot]
ff75980135 [pre-commit.ci] pre-commit autoupdate (#12447)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.4.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.7...v0.4.8)
- [github.com/asottile/pyupgrade: v3.15.2 → v3.16.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.16.0)

* Apply pyupgrade automatically

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2024-06-11 12:36:39 -03:00
Ran Benita
23ca9798f7 doc: fix broken code blocks (#12449)
Caused by 4588653b24.

The issue was fixed in https://github.com/astral-sh/ruff/issues/11577,
so won't trigger again.

Fix #12437.
2024-06-11 12:36:20 -03:00
Ran Benita
f3946dce07 Merge pull request #12443 from bluetech/pygments-refactor
terminalwriter: small refactor of pygments code, improve usage errors
2024-06-10 14:13:46 +03:00
Ran Benita
7ef9da1f02 terminalwriter: improve PYTEST_THEME, PYTEST_THEME_MODE usage errors 2024-06-10 11:50:08 +03:00
Ran Benita
67a570aea9 terminalwriter: factor out pygments lexer & formatter selection to own functions
We intend to add some more logic here.
2024-06-10 11:48:19 +03:00
dependabot[bot]
3d91e42229 build(deps): Bump pytest-bdd in /testing/plugins_integration (#12442)
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 7.1.2 to 7.2.0.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/7.1.2...7.2.0)

---
updated-dependencies:
- dependency-name: pytest-bdd
  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-10 08:28:57 +02:00
github-actions[bot]
9bfcca6f48 [automated] Update plugin list (#12441)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-06-09 22:49:33 -03:00
Ran Benita
f85289ba87 Merge pull request #12436 from bluetech/unittest-rerun-assertion
unittest: fix assertion errors on unittest reruns
2024-06-08 02:11:20 +03:00
Ran Benita
18f15a38fc Merge pull request #12435 from bluetech/avoid-type-checking
Avoid some `TYPE_CHECKING`
2024-06-08 02:11:06 +03:00
Ran Benita
db67107090 Merge pull request #12434 from bluetech/register-fixture-scope-none
fixtures: change `register_fixture` to not accept `scope=None`
2024-06-07 12:11:56 +03:00
Ran Benita
de47b73520 unittest: fix assertion errors on unittest reruns
This fixes unittest test reruns when using plugins like
pytest-rerunfailures.

The `instance` property uses AttributeError to check if the instance
needs to be initialized, so `del` is the correct way to clear it, not
setting to `None`.

Regressed in 8.2.2.
2024-06-07 10:21:15 +03:00
Ran Benita
8585c58826 Merge pull request #10470 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-trio-0.8.0
build(deps): Bump pytest-trio from 0.7.0 to 0.8.0 in /testing/plugins_integration
2024-06-07 10:20:42 +03:00
dependabot[bot]
13f97632c6 build(deps): Bump pytest-trio in /testing/plugins_integration
Bumps [pytest-trio](https://github.com/python-trio/pytest-trio) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/python-trio/pytest-trio/releases)
- [Commits](https://github.com/python-trio/pytest-trio/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: pytest-trio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-07 07:03:09 +00:00
Ran Benita
c07bbdfa5b Avoid some TYPE_CHECKING
It's better not to use it when possible.
2024-06-07 09:36:55 +03:00
Jason R. Coombs
f941099371 Cleanup MockAwareDocTestFinder. (#12431)
* Only rely on _find_lineno on Python 3.10 and earlier.

* Update docstring to reflect current expectation.

* Only rely on _find on Python 3.9 and earlier.

* Mark line as uncovered.

* Remove empty else block (implicit is better than explicit).

Closes #12430
Closes #12432
2024-06-07 09:32:33 +03:00
Tomasz Kłoczko
6b2daaa2e9 [pre-commit] Add pyupgrade back as a manual stage (#12418)
Launchable with ``pre-commit run --hook-stage manual pyupgrade -a``

---------

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2024-06-06 23:52:29 +02:00
holger krekel
043ff9abc6 Remove hp42 contact details from the documentation (#12427) 2024-06-06 10:24:31 +00:00
Ran Benita
c9d8765381 fixtures: change register_fixture to not accept scope=None
There is no reason to allow this.
2024-06-04 23:22:18 +03:00
Ran Benita
0070151c63 Merge pull request #12416 from bluetech/cherry-pick-release
Cherry-pick 8.2.2 release notes
2024-06-04 17:22:29 +03:00
Ran Benita
4cd80e19c5 Merge pull request #12415 from pytest-dev/release-8.2.2
Prepare release 8.2.2

(cherry picked from commit f3a494cca3)
2024-06-04 16:52:15 +03:00
Ran Benita
d4dbe771f0 Merge pull request #12409 from bluetech/reorder-items-perf
fixtures: fix catastrophic performance problem in `reorder_items`
2024-06-04 10:16:19 +03:00
Ran Benita
e89d23b247 fixtures: fix catastrophic performance problem in reorder_items
Fix #12355.

In the issue, it was reported that the `reorder_items` has quadratic (or
worse...) behavior with certain simple parametrizations. After some
debugging I found that the problem happens because the "Fix
items_by_argkey order" loop keeps adding the same item to the deque,
and it reaches epic sizes which causes the slowdown.

I don't claim to understand how the `reorder_items` algorithm works, but
if as far as I understand, if an item already exists in the deque, the
correct thing to do is to move it to the front. Since a deque doesn't
have such an (efficient) operation, this switches to `OrderedDict` which
can efficiently append from both sides, deduplicate and move to front.
2024-06-04 10:15:50 +03:00
pre-commit-ci[bot]
3433c7adf5 [pre-commit.ci] pre-commit autoupdate (#12413)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.5 → v0.4.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.5...v0.4.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-04 09:06:33 +02:00
Michael Vogt
7be95f9b30 code: do not truncate args when running with -vvv (#12241)
Related to #2871.
2024-06-03 12:11:41 +00:00
Ran Benita
177f2ae6c4 Merge pull request #12408 from bluetech/cache-race
cacheprovider: fix "Directory not empty" crash from cache directory creation
2024-06-03 12:43:59 +03:00
Ran Benita
1eee63a891 fixtures: minor cleanups to reorder_items
This makes some minor clarity and performance improvements to the code.
2024-06-02 18:31:54 +03:00
Ran Benita
17065cb008 cacheprovider: fix "Directory not empty" crash from cache directory creation
Fix #12381

Test plan:
It's possible to write a deterministic test case for this, but somewhat
of a hassle so I tested it manually. I reproduced by removing existing
`.pytest_cache`, adding a sleep before the rename and running two
pytests. I verified that it doesn't reproduce after the fix.
2024-06-02 17:05:36 +03:00
github-actions[bot]
98021838fd [automated] Update plugin list (#12405)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-06-02 09:31:40 -03:00
Florian Bruhin
10c6db2df2 doc: Update trainings/events (#12401) 2024-05-30 16:48:37 +02:00
Pierre Sassoulas
0ba3e91fbd Merge pull request #12379 from Pierre-Sassoulas/more-pylint-fixes
[pylint] Fix ``consider-using-sys-exit``, ``use-yield-from``, and ``implicit-str-concat``
2024-05-29 15:07:04 +02:00
Pierre Sassoulas
908e112999 [pylint 'implicit-str-concat'] fix existing unwanted implicit str concat 2024-05-29 14:36:01 +02:00
Pierre Sassoulas
0d33cdf02a [pylint] Disable the only 'misplaced-bare-raise' 2024-05-29 14:36:01 +02:00
Pierre Sassoulas
c45afde35d [pylint 'consider-using-sys-exit'] Fix all occurences in existing code 2024-05-29 14:36:01 +02:00
Pierre Sassoulas
db67d5c874 [pylint 'use-yield-from'] Fix all occurences in existing code 2024-05-29 14:36:01 +02:00
dependabot[bot]
383659d0be build(deps): Bump hynek/build-and-inspect-python-package (#12373)
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v2.5.0...v2.6.0)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  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-05-29 13:39:29 +02:00
Bruno Oliveira
9f121e85a7 Clarify pytest_ignore_collect docs (#12385)
Fixes #12383

Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-05-28 13:47:00 -03:00
pre-commit-ci[bot]
48cb8a2b32 [pre-commit.ci] pre-commit autoupdate (#12380)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.4 → v0.4.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.4...v0.4.5)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-27 22:31:18 +00:00
Pierre Sassoulas
88fae23bdd [pylint] Fixes all `use-maxplit-args, consider-using-enumerate` (#12172)
* [pylint 'use-maxsplit-arg'] Do not split more than necessary when using the first element

* [pylint 'consider-using-enumerate'] Use zip when iterating on two iterators

* [pylint] 'cell-var-from-loop' and 'disallowed-name' permanent disable

* [pylint] Disable 'possibly-used-before-assignment' following 3.2.0 release
2024-05-27 12:18:03 -07:00
dependabot[bot]
24abe4eb03 build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#12374)
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 4.3.0 to 4.4.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/4.3.0...4.4.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  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-05-27 06:43:30 +02:00
James Frost
020db7ec04 Add html_baseurl to sphinx conf.py (#12364)
This is used to set the <link rel="canonical" href="X"> tag that points to the canonical version of the webpage. Including this indicates to search engines which version to include in their indexes, and should prevent older versions showing up.

Fixes #12363
2024-05-26 07:21:30 -03:00
Ran Benita
f8dfc1d5f0 Merge pull request #12368 from bluetech/unittest-clear-instance
unittest: fix class instances no longer released on test teardown since pytest 8.2.0
2024-05-26 10:34:11 +03:00
Ran Benita
c3c51037f0 unittest: fix class instances no longer released on test teardown since pytest 8.2.0
Fix #12367.
2024-05-26 10:18:42 +03:00
Ran Benita
3fbf4d3cbd Merge pull request #12369 from pytest-dev/update-plugin-list/patch-889d9b28d
[automated] Update plugin list
2024-05-26 10:14:35 +03:00
pytest bot
b83dd34ce1 [automated] Update plugin list 2024-05-26 00:21:28 +00:00
Nathan Goldbaum
889d9b28d7 Add thread safety section to flaky test docs (#12359)
Closes #12356
2024-05-24 08:16:44 -03:00
Sam Jirovec
cbf6bd9dd2 Issue #12290 - Docs using Furo Theme W/ Dark Mode (#12326)
* furo theme for docs site

* removing duplicate tocs from deprecations and reference pages

* removing pallets references in code and config

* reverting trainings to sidebar

* removed sphinx style and unpinned packaging version

* updated styles
2024-05-21 13:56:18 +00:00
pre-commit-ci[bot]
5d5c9dc858 [pre-commit.ci] pre-commit autoupdate (#12321)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.3 → v0.4.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.3...v0.4.4)
- [github.com/tox-dev/pyproject-fmt: 1.8.0 → 2.1.3](https://github.com/tox-dev/pyproject-fmt/compare/1.8.0...2.1.3)

Also fix the comment following autofix

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2024-05-21 07:04:09 +00:00
dependabot[bot]
00be7c0739 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#12345)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.6 to 0.23.7.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.6...v0.23.7)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-20 07:11:04 +02:00
Hynek Schlawack
d4f827d86b Fix link in changelog (#12343) 2024-05-19 21:14:45 +00:00
Ran Benita
69fa9bae43 Merge pull request #12342 from bluetech/cherry-pick-release
Cherry pick 8.2.1 release notes
2024-05-19 22:37:32 +03:00
pytest bot
32baa0b93d Prepare release version 8.2.1
(cherry picked from commit 66ff8dffdf)
2024-05-19 22:11:09 +03:00
Ran Benita
d5b6d44d0e Merge pull request #12339 from pytest-dev/update-plugin-list/patch-ee9ea703f
[automated] Update plugin list
2024-05-19 12:47:55 +03:00
Ran Benita
c1d623cbff Merge pull request #12334 from bluetech/py313
Add Python 3.13 (beta) support
2024-05-19 09:45:09 +03:00
Ran Benita
1cb704ff2c Add Python 3.13 (beta1) support 2024-05-19 09:25:13 +03:00
pytest bot
cb732bbfb0 [automated] Update plugin list 2024-05-19 00:21:06 +00:00
Ran Benita
dbee3fa34a testing: remove conditionals for Python 3.11 beta releases
No need to support beta releases of an older version anymore.

Ref: 09b2c95320
2024-05-18 19:53:50 +03:00
Jelle Zijlstra
ee9ea703f9 Fix new typing issues in AST code (#12337)
python/typeshed#11880 adds more precise types for AST nodes. I'm submitting some changes to adapt pytest to these changes.
2024-05-18 19:07:06 +03:00
Bruno Oliveira
635fbe2bff Attest package provenance (#12333)
Use the new build provenance support added in [build-and-inspect-python-package 2.5.0](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md#250---2024-05-13).

More information: https://github.blog/2024-05-02-introducing-artifact-attestations-now-in-public-beta/

Tested also in https://github.com/pytest-dev/pytest-mock/pull/431.

Note: even though it is technically necessary only for the `deploy` workflow, as the `test` workflow does not publish its packages, decided to always attest the provenance in both cases to avoid any surprises related to this (say a misconfiguration) when deploying.
2024-05-17 08:19:13 -03:00
Ran Benita
fdf3aa3fc3 Merge pull request #12329 from pytest-dev/fix-package-scope-reorder
fixtures: fix non-working package-scope parametrization reordering
2024-05-16 10:30:34 +03:00
Josh Soref
8d00811822 Spelling and minor changes (#12122) 2024-05-15 13:49:34 -03:00
Ran Benita
1acf56d033 fixtures: fix non-working package-scope parametrization reordering
The `.parent` was incorrectly removed in
a21fb87a90, but it was actually correct
(well, it assumes that Module.path.parent == Package.path, which I'm not
sure is always correct, but that's a different matter). Restore it.

Fix #12328.
2024-05-15 17:29:43 +03:00
Ran Benita
fa1d5be3e8 Merge pull request #12325 from bluetech/pytest-cache-755
cacheprovider: fix `.pytest_cache` not being world-readable
2024-05-15 10:57:10 +03:00
Ran Benita
3a64c47f1f cacheprovider: fix .pytest_cache not being world-readable
Fix #12308.
2024-05-14 23:47:12 +03:00
Ran Benita
ae1a47e050 Merge pull request #12320 from pytest-dev/ut-breaking-change
changelog: document unittest 8.2 change as breaking
2024-05-14 23:06:48 +03:00
Ran Benita
ebe2e8eac9 changelog: document unittest 8.2 change as breaking 2024-05-13 22:34:35 +03:00
Ran Benita
93dd34e76d Merge pull request #12310 from pytest-dev/update-plugin-list/patch-5af46f3d4
[automated] Update plugin list
2024-05-13 20:34:35 +03:00
Ran Benita
704792ecbd Merge pull request #12311 from bluetech/pkg-collect-perm-error
python: add workaround for permission error crashes from non-selected directories
2024-05-13 20:32:23 +03:00
Ran Benita
d4223b9ae2 Merge pull request #12318 from bluetech/unittest-abc
python,unittest: don't collect abstract classes
2024-05-13 20:22:10 +03:00
Ran Benita
37489d3c6c python,unittest: don't collect abstract classes
Fix #12275.
2024-05-13 13:00:47 +03:00
dependabot[bot]
eea04c2891 build(deps): Bump django in /testing/plugins_integration (#12314)
Bumps [django](https://github.com/django/django) from 5.0.4 to 5.0.6.
- [Commits](https://github.com/django/django/compare/5.0.4...5.0.6)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-13 05:56:16 +02:00
Ran Benita
90a3ef2f36 python: add workaround for permission error crashes from non-selected directories
Fix #12120.
2024-05-12 22:38:49 +03:00
pytest bot
e20a08565f [automated] Update plugin list 2024-05-12 00:21:02 +00:00
Yutian Li
5af46f3d4e Fix crashing under squashfuse_ll read-only mounts (#12301)
Fixes #12300
2024-05-09 15:04:58 -03:00
Florian Bruhin
d49f1fc4db doc: update sprint repo link (#12296) 2024-05-08 10:13:30 -03:00
Brian Okken
8efbefb2d7 New --xfail-tb flag (#12280)
Fix #12231
2024-05-07 14:37:00 -03:00
pre-commit-ci[bot]
4080459f04 [pre-commit.ci] pre-commit autoupdate (#12292)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.2 → v0.4.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.2...v0.4.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-07 07:28:34 +02:00
Bruno Oliveira
84e59af8c8 Document exceptions raised by exit, skip, xfail, fail, and importorskip (#12285)
As commented on: https://github.com/pytest-dev/pytest/issues/7469#issuecomment-2094104215
2024-05-05 22:53:16 +00:00
github-actions[bot]
3d09c85df0 [automated] Update plugin list (#12286)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-05-04 21:26:09 -03:00
Anita Hammer
97610067ac Handle KeyboardInterrupt and SystemExit at collection time (#12191) 2024-05-02 11:59:09 +00:00
Ben Brown
4c5298c395 Add back "Fix teardown error reporting when --maxfail=1 (#11721)" (#12279)
Closes #11706.

Originally fixed in #11721, but then reverted in #12022 due to a regression in pytest-xdist.

The regression was fixed on the pytest-xdist side in pytest-dev/pytest-xdist#1026.
2024-05-02 10:42:31 +03:00
Ran Benita
c3e9bd4518 Merge pull request #12271 from bluetech/restore-bdd
testing: restore integration testing with pytest-bdd
2024-05-02 10:27:08 +03:00
Pierre Sassoulas
1385ec117d Merge pull request #12274 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-04-30 18:32:12 +02:00
Pierre Sassoulas
65d7d6135e [ruff] Add change to format in the git blame ignore file 2024-04-30 18:13:04 +02:00
Pierre Sassoulas
2b6c946a2b [mypy 1.10.0] Remove 'type: ignore' that became useless 2024-04-30 18:11:06 +02:00
Pierre Sassoulas
4788165e69 [ruff UP031] Fix to use format specifiers instead of percent format 2024-04-30 18:06:26 +02:00
pre-commit-ci[bot]
da53e29780 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.1 → v0.4.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.1...v0.4.2)
- [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.9.0...v1.10.0)
2024-04-29 22:30:08 +00:00
Ran Benita
b660596f61 testing: restore integration testing with pytest-bdd
The problem was fixed.
2024-04-29 20:52:35 +03:00
Ran Benita
feaae2fb35 Merge pull request #12264 from bluetech/reraise-with-original-tb
fixtures,runner: fix tracebacks getting longer and longer
2024-04-29 20:02:44 +03:00
dependabot[bot]
cf90008a1a build(deps): Bump peter-evans/create-pull-request from 6.0.4 to 6.0.5 (#12268)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.4 to 6.0.5.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](9153d834b6...6d6857d369)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-29 08:38:05 -03:00
dj
2ede8778d0 Document using PYTEST_VERSION to detect if a code is running inside pytest (#12153)
Related to #9502
2024-04-28 15:52:29 -03:00
Ran Benita
2e1dfb0c16 Merge pull request #12265 from bluetech/pre-commit-tweaks
pre-commit tweaks
2024-04-28 17:52:38 +03:00
Ran Benita
940b78232e pre-commit: fix misleading indentation 2024-04-28 17:11:11 +03:00
Ran Benita
e847b2a5a9 pre-commit: replace debug-statements hook with ruff
Ruff supports this functionality so we can use it.
2024-04-28 17:06:07 +03:00
Ran Benita
85bc9ca954 pre-commit: remove deprecated fix-encoding-pragma hook
Deprecated by pre-commit.
2024-04-28 17:06:07 +03:00
Ran Benita
ebc4540436 Merge pull request #12258 from bluetech/xdist-align
terminal: fix progress percentages not aligning correctly in xdist
2024-04-28 16:52:40 +03:00
Ran Benita
3e81cb2f45 runner: fix tracebacks for failed collectors getting longer and longer
Refs https://github.com/pytest-dev/pytest/issues/12204#issuecomment-2081239376
2024-04-28 13:30:05 +03:00
Ran Benita
0b91d5e3e8 fixtures: fix tracebacks for higher-scoped failed fixtures getting longer and longer
Fix #12204.
2024-04-28 13:06:32 +03:00
Ran Benita
50d1e81713 terminal: fix progress percentages not aligning correctly in xdist
Fix #7166
2024-04-28 11:33:18 +03:00
Ran Benita
1a84d233f3 terminal: some minor code cleanups
No logical changed intended.
2024-04-28 11:33:18 +03:00
Ran Benita
127a372928 Merge pull request #12259 from bluetech/plain-raise
runner: avoid adding uninteresting entry to tracebacks
2024-04-28 11:21:15 +03:00
Bruno Oliveira
2a809e6f8b Merge pull request #12261 from pytest-dev/update-plugin-list/patch-9eecdc7da
[automated] Update plugin list
2024-04-27 22:09:19 -03:00
pytest bot
852df0dc3e [automated] Update plugin list 2024-04-28 00:20:56 +00:00
Bruno Oliveira
9eecdc7dae Merge pull request #12260 from nicoddemus/cherry-pick-release
Cherry-pick release pytest-dev/release-8.2.0
2024-04-27 20:41:36 -03:00
Bruno Oliveira
79ca819e59 Merge pull request #12257 from pytest-dev/release-8.2.0
Prepare release 8.2.0

(cherry picked from commit 69c3bcea36)
2024-04-27 20:36:02 -03:00
Ran Benita
fc5c960304 runner: avoid adding uninteresting entry to tracebacks
In these two cases which re-raise an immediately-caught exception, do
the re-raising with `raise` instead of `raise exc`, because the `raise
exc` adds an uninteresting entry to the exception's traceback (that of
itself), while `raise` doesn't.
2024-04-28 01:42:43 +03:00
Bruno Oliveira
835765c9d3 Merge pull request #12130 from bluetech/fixtures-inline
fixtures: inline some functions to streamline the code
2024-04-27 10:01:36 -03:00
Daniel Miller
7e7503c0b0 unittest: report class cleanup exceptions (#12250)
Fixes #11728

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-04-27 09:49:05 -03:00
Ran Benita
882c4da2f3 fixtures: inline fail_fixturefunc
Doesn't add much.
2024-04-27 09:48:14 -03:00
Ran Benita
2e8fb9f140 fixtures: extract a _check_fixturedef method
This stuff is less interesting when reading `_get_active_fixturedef`.
2024-04-27 09:48:14 -03:00
Ran Benita
acf2971f46 fixtures: inline _getnextfixturedef into _get_active_fixturedef 2024-04-27 09:48:14 -03:00
Ran Benita
3c77aec1da fixtures: move "request" check early 2024-04-27 09:48:14 -03:00
Ran Benita
d217d68cde fixtures: inline _compute_fixture_value 2024-04-27 09:48:14 -03:00
Ran Benita
530be28575 fixtures: use early return in _get_active_fixturedef 2024-04-27 09:48:14 -03:00
Bruno Oliveira
d208c1d4a5 Merge pull request #12256 from bluetech/misc2
2 small cleanups
2024-04-27 09:39:16 -03:00
Ran Benita
80ca255d42 pathlib: make absolutepath support os.PathLike[str]
This slightly simplifies a bit of path.
2024-04-27 11:53:01 +03:00
Ran Benita
1a332802ff Avoid slicing sys.version_info in version conditionals
It is unnecessary, and some static analyzers don't handle it.
2024-04-27 01:14:21 +03:00
Bruno Oliveira
93c2cdf6d6 cherry-pick release-8.1.2 (#12252)
(cherry picked from commit 7df3dbc545)
2024-04-26 15:25:44 -03:00
Shekhar verma
4eb8b6d525 Changed importError to ModuleNotFoundError (#12220)
* Changed importError to ModuleNotFoundError

* added testing for importorskip

* added exc_types parameter in importorskip

* Added warning and Test Cases

* Improve tests and docs

* Improve deprecation docs

* Change exc_type to kw only

* Apply suggestions from code review

Co-authored-by: Florian Bruhin <me@the-compiler.org>

* Fix check

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2024-04-26 09:48:57 +02:00
pre-commit-ci[bot]
fafab1dbfd [pre-commit.ci] pre-commit autoupdate (#12238)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.7 → v0.4.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.7...v0.4.1)
- [github.com/tox-dev/pyproject-fmt: 1.7.0 → 1.8.0](https://github.com/tox-dev/pyproject-fmt/compare/1.7.0...1.8.0)

* noqa a test

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2024-04-23 11:59:12 -03:00
poulami-sau
5cffef7f07 Fixed Bug Regarding Attribute Error in pytest.approx For Types Implicitly Convertible to Numpy Arrays (#12232)
* added test case in testing/python/approx.py based on test case provided by reporter in issue #12114
* test cases pass for pytest testing/python/approx.py
* expanded the type annotation to include objects which may cast to a array and renamed other_side to other_side_as_array and asserted that it is not none
2024-04-23 10:45:33 +02:00
Florian Bruhin
a830a3e98d Update events/trainings (#12236) 2024-04-22 19:52:25 +02:00
dependabot[bot]
1d322ffb48 build(deps): Bump peter-evans/create-pull-request from 6.0.3 to 6.0.4 (#12233)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.3 to 6.0.4.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](c55203cfde...9153d834b6)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 11:54:48 +02:00
github-actions[bot]
63d985c6d3 [automated] Update plugin list (#12230)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-04-21 10:57:36 -03:00
Ran Benita
3617ef1c79 Merge pull request #12227 from bluetech/deprecate-legacy-path-impls
hookspec: deprecate hookimpls requesting py.path parameters
2024-04-21 11:52:16 +03:00
Ran Benita
58136c5376 hookspec: deprecate hookimpls requesting py.path parameters 2024-04-21 11:37:56 +03:00
Bruno Oliveira
042625957a Fully type annotate pathlib.py (#12229)
Add full type annotations to `pathlib.py` and remove the `allow-untyped-defs` directive.
2024-04-20 16:32:36 -03:00
Bruno Oliveira
6fb474a3eb Refactor insert_missing_modules function (#12210)
Makes the logic more straightforward IMO.
2024-04-20 11:58:14 +00:00
Bruno Oliveira
ff806b239e importlib: set children as attribute of parent modules (#12208)
Now `importlib` mode will correctly set the imported modules as an attribute of their parent modules.

As helpfully posted on #12194, that's how the Python import module works so we should follow suit.

In addition, we also try to import the parent modules as part of the process of importing a child module, again mirroring how Python importing works.

Fix #12194
2024-04-20 11:31:33 +00:00
dj
ad95d59d61 Use monkeypatch in test_pytest_version_env_var
Follow up to #12190
2024-04-18 23:05:29 -03:00
dj
48b6d18834 Add PYTEST_VERSION environment variable (#12190)
Among other things, it can be used to check if a code is running from within a pytest session.

Fixes #9502
2024-04-18 07:45:47 -03:00
pre-commit-ci[bot]
58844247f7 [pre-commit.ci] pre-commit autoupdate (#12218)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.5 → v0.3.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.5...v0.3.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-15 23:04:19 +00:00
dependabot[bot]
b56b294f54 build(deps): Bump peter-evans/create-pull-request from 6.0.2 to 6.0.3 (#12215)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.2 to 6.0.3.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](70a41aba78...c55203cfde)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 13:08:38 -03:00
Ran Benita
6e248818b9 Merge pull request #12212 from pytest-dev/update-plugin-list/patch-089116bdf
[automated] Update plugin list
2024-04-15 17:59:30 +03:00
dependabot[bot]
0644e467fb build(deps): Bump hynek/build-and-inspect-python-package (#12214)
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 2.2.1 to 2.4.0.
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v2.2.1...v2.4.0)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  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-04-15 10:33:41 +02:00
pytest bot
5f6e825a26 [automated] Update plugin list 2024-04-14 00:21:52 +00:00
HolyMagician03-UMich
089116bdff short test summary: do not truncate text when -vv is given
Fix #11777

---------

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-04-10 08:07:18 -03:00
Ran Benita
1f001cd105 Merge pull request #12199 from tamird/mkdir-test-init
Add test for Cache.mkdir
2024-04-09 22:26:36 +03:00
Bruno Oliveira
99890636bf Refine how we detect namespace packages (#12169)
Previously we used a hand crafted approach to detect namespace packages, however we should rely on ``importlib`` to detect them for us.

Fix #12112

---------

Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-04-09 13:21:51 -03:00
dependabot[bot]
17fc20af78 build(deps): Bump hynek/build-and-inspect-python-package (#12195)
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 2.0.2 to 2.2.1.
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v2.0.2...v2.2.1)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  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>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2024-04-09 10:04:42 -03:00
pre-commit-ci[bot]
1ca59dfd6b [pre-commit.ci] pre-commit autoupdate (#12200)
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-09 09:55:05 -03:00
Tamir Duberstein
e06c337bd8 Add test for Cache.mkdir 2024-04-08 15:08:18 +01:00
Tamir Duberstein
a02cc0ad1b Add types 2024-04-08 15:08:17 +01:00
dependabot[bot]
74f05648d5 build(deps): Bump django in /testing/plugins_integration (#12196)
Bumps [django](https://github.com/django/django) from 5.0.3 to 5.0.4.
- [Commits](https://github.com/django/django/compare/5.0.3...5.0.4)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-08 12:15:01 +02:00
github-actions[bot]
f75dd87eb7 [automated] Update plugin list (#12193)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-04-07 08:57:04 -03:00
Ran Benita
5acc3f86ac Merge pull request #12168 from tamird/fix-gitignore-missing
Initialize cache directory in isolation
2024-04-06 23:18:19 +03:00
Florian Bruhin
4e3dd21506 Improve stale bot messages (#12185)
To avoid confusion, see e.g. https://github.com/pytest-dev/pytest/issues/12123#issuecomment-2035283472

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2024-04-04 00:24:34 +02:00
Tamir Duberstein
2e65f4e3ac Initialize cache directory in isolation
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes #12167.
2024-04-03 16:26:43 +01:00
Manuel López-Ibáñez
cc588d1a1a Doc: import pytest in conftest.py example in doctest.rst (#12181) 2024-04-03 09:02:09 -03:00
Ran Benita
b63bea9523 Merge pull request #11910 from bluetech/move-show-fixtures
Move show-fixtures code from python.py to fixtures.py
2024-04-02 23:28:32 +03:00
Ran Benita
a10ddad774 Merge pull request #12171 from pytest-dev/update-plugin-list/patch-12e061e2e
[automated] Update plugin list
2024-04-02 23:15:16 +03:00
Ran Benita
1188ea2608 Move show-fixtures code from python.py to fixtures.py
It makes more sense, also, we have a long term idea of generalizing
fixture support to items defined by other plugins, not just python, in
which case `--fixtures` would definitely not be python-plugin
specific.
2024-04-02 23:02:10 +03:00
Ran Benita
aa5324560b Merge pull request #12159 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-cov-5.0.0
build(deps): Bump pytest-cov from 4.1.0 to 5.0.0 in /testing/plugins_integration
2024-04-02 22:59:20 +03:00
Ronny Pfannschmidt
381593ccf0 Merge pull request #12176 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-04-02 08:41:02 +02:00
pre-commit-ci[bot]
9d6b5f8772 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.4 → v0.3.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.4...v0.3.5)
2024-04-01 22:13:25 +00:00
Pierre Sassoulas
44895289c7 Merge pull request #12170 from Pierre-Sassoulas/small-performance-improvments
Small performance/readability improvments when iterating dictionnary with ``keys()``
2024-03-31 15:15:03 +02:00
Pierre Sassoulas
1125296b53 Small performance/readability improvments when iterating dictionnary with `keys()`
Based on pylint's message ``consider-iterating-dictionary`` suggestion.
Surprisingly using a dict or set comprehension instead of a new temp var is
actually consistently slower here, which was not intuitive for me.

```python
from timeit import timeit

families = {1: {"testcase": [1, 2, 3, 5, 8]}}
attrs = {1: "a", 2: "b", 3: "c", 4: "d", 5: "e", 6: "f", 7: "g", 8: "h"}

class Old:
    def old(self):
        self.attrs = attrs
        temp_attrs = {}
        for key in self.attrs.keys():
            if key in families[1]["testcase"]:
                temp_attrs[key] = self.attrs[key]
        self.attrs = temp_attrs

class OldBis:
    def old(self):
        self.attrs = attrs
        temp_attrs = {}
        for key in self.attrs:
            if key in families[1]["testcase"]:
                temp_attrs[key] = self.attrs[key]
        self.attrs = temp_attrs

class New:
    def new(self):
        self.attrs = attrs
        self.attrs = { # Even worse with k: v for k in self.attrs.items()
            k: self.attrs[k] for k in self.attrs if k in families[1]["testcase"]
        }

if __name__ == "__main__":
    n = 1000000
    print(f"Old: {timeit(Old().old, number=n)}")
    print(f"Just removing the keys(): {timeit(OldBis().old, number=n)}")
    print(f"List comp, no temp var: {timeit(New().new, number=n)}")
```

Result:
Old: 0.9493889989680611
Just removing the keys(): 0.9042672360083088
List comp, no temp var: 0.9916125109884888

It's also true for the other example with similar benchmark, but the exact
code probably does not need to be in the commit message.
2024-03-31 14:43:07 +02:00
Pierre Sassoulas
bd9b62161a [tooling] Add a manual step to run pylint in pre-commit 2024-03-31 14:43:07 +02:00
John Litborn
e64efd8653 Don't reregister subfixture finalizer in requested fixture if value is cached (#12136) 2024-03-31 15:02:09 +03:00
pytest bot
2dd58e827e [automated] Update plugin list 2024-03-31 00:20:45 +00:00
pre-commit-ci[bot]
12e061e2e8 [pre-commit.ci] pre-commit autoupdate (#12162)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.3 → v0.3.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.3...v0.3.4)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-25 23:37:36 +01:00
dependabot[bot]
5d345f6d7f build(deps): Bump pytest-cov in /testing/plugins_integration
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 4.1.0 to 5.0.0.
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v4.1.0...v5.0.0)

---
updated-dependencies:
- dependency-name: pytest-cov
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-25 06:32:55 +00:00
dependabot[bot]
2cba2237cd build(deps): Bump pytest-twisted in /testing/plugins_integration (#12158)
Bumps [pytest-twisted](https://github.com/pytest-dev/pytest-twisted) from 1.14.0 to 1.14.1.
- [Release notes](https://github.com/pytest-dev/pytest-twisted/releases)
- [Commits](https://github.com/pytest-dev/pytest-twisted/compare/v1.14.0...v1.14.1)

---
updated-dependencies:
- dependency-name: pytest-twisted
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 07:32:29 +01:00
dependabot[bot]
e7b048e92d build(deps): Bump pytest-mock in /testing/plugins_integration (#12160)
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.12.0 to 3.14.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.12.0...v3.14.0)

---
updated-dependencies:
- dependency-name: pytest-mock
  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-03-25 07:30:45 +01:00
dependabot[bot]
4a8cefbf64 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#12161)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.5 to 0.23.6.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.5...v0.23.6)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 07:30:08 +01:00
tserg
909759de2d Improve sentence in marks documentation (#12157) 2024-03-24 15:59:07 +01:00
Ran Benita
85ff5d1b54 Merge pull request #12156 from pytest-dev/update-plugin-list/patch-c650e3a94
[automated] Update plugin list
2024-03-24 16:15:46 +02:00
Ran Benita
cfc4cf074e Merge pull request #12154 from bluetech/fixtures-cache-key-idx
fixtures: stop using `request.param_index` in fixture cache key
2024-03-24 15:40:52 +02:00
pytest bot
aeae91e27d [automated] Update plugin list 2024-03-24 00:20:37 +00:00
Ran Benita
3eb16b34be fixtures: stop using request.param_index in fixture cache key
When `param` is not defined, `param_index` is always 0 (see
`_compute_fixture_value`), so no point in using it besides adding some
confusion.
2024-03-23 12:07:24 +02:00
Linghao Zhang
c650e3a94f Add research item in doc (#12147) 2024-03-21 11:21:43 -03:00
Ran Benita
470edc5884 Merge pull request #12133 from pytest-dev/dependabot/github_actions/hynek/build-and-inspect-python-package-2.0.2
build(deps): Bump hynek/build-and-inspect-python-package from 2.0.1 to 2.0.2
2024-03-20 11:21:40 +02:00
Ran Benita
07a08028de Merge pull request #12132 from pytest-dev/dependabot/github_actions/peter-evans/create-pull-request-6.0.2
build(deps): Bump peter-evans/create-pull-request from 6.0.0 to 6.0.2
2024-03-20 11:20:50 +02:00
Ran Benita
42d3960fea Merge pull request #12131 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-rerunfailures-14.0
build(deps): Bump pytest-rerunfailures from 13.0 to 14.0 in /testing/plugins_integration
2024-03-20 11:20:09 +02:00
Sebastian Meyer
e7bf216516 doc: add versionadded to ExceptionInfo.group_contains (#12141) 2024-03-19 19:54:26 -03:00
pre-commit-ci[bot]
532782a228 [pre-commit.ci] pre-commit autoupdate (#12137)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.3.2 → v0.3.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.2...v0.3.3)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-18 22:51:23 +00:00
dependabot[bot]
bf8b088bbe build(deps): Bump hynek/build-and-inspect-python-package
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 03:12:49 +00:00
dependabot[bot]
027464975f build(deps): Bump peter-evans/create-pull-request from 6.0.0 to 6.0.2
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](b1ddad2c99...70a41aba78)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 03:12:45 +00:00
dependabot[bot]
6be5c9d88c build(deps): Bump pytest-rerunfailures in /testing/plugins_integration
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 13.0 to 14.0.
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/13.0...14.0)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 03:02:28 +00:00
Ran Benita
2607fe8b47 Merge pull request #12126 from pytest-dev/update-plugin-list/patch-70c11582a
[automated] Update plugin list
2024-03-17 21:22:45 +02:00
pytest bot
2e69f31444 [automated] Update plugin list 2024-03-17 00:20:04 +00:00
John Litborn
70c11582aa Don't add fixture finalizer if the value is cached (#11833)
Fixes #1489
2024-03-16 23:45:56 +02:00
Ran Benita
c203f1615c Merge pull request #12121 from jakkdl/test_scope_fixture_caching
Add tests to ensure setup&finalization for scoped fixtures only run once.
2024-03-16 12:21:53 +02:00
jakkdl
bec0e9caf8 Add tests to ensure setup&finalization for scoped fixtures only run once. 2024-03-15 12:26:28 +01:00
Tobias Stoeckmann
2e5da5d2fb doc: fix typos (#12118)
* doc: add missing word

* doc: fix typos

Typos found with codespell
2024-03-14 16:36:11 +00:00
pre-commit-ci[bot]
c0532dda18 [pre-commit.ci] pre-commit autoupdate (#12115)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-03-13 15:30:18 +02:00
Ran Benita
14437788f0 Merge pull request #12108 from pytest-dev/bluetech-patch-1
doc: add versionadded to `Stash` and `StashKey`
2024-03-11 18:36:16 +02:00
Ran Benita
7eaaf370bb doc: add versionadded to Stash and StashKey
Fixes #12107
2024-03-11 18:22:16 +02:00
dependabot[bot]
6c9e107681 build(deps): Bump softprops/action-gh-release from 1 to 2 (#12106)
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-11 11:48:06 -03:00
dependabot[bot]
122b43439c build(deps): Bump django in /testing/plugins_integration (#12103)
Bumps [django](https://github.com/django/django) from 5.0.2 to 5.0.3.
- [Commits](https://github.com/django/django/compare/5.0.2...5.0.3)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-11 07:05:41 +01:00
dependabot[bot]
a29ea1bc32 build(deps): Bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14 (#12105)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.12 to 1.8.14.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.12...v1.8.14)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-11 07:04:19 +01:00
Ran Benita
0a442a9599 doc/flaky: remove box/flaky plugin suggestion (#12100)
The plugin is abandoned and no longer working with new pytest versions.

I also reordered a bit to put pytest-rerunfailures first since it seems most maintained and is under pytest-dev.
2024-03-10 11:51:04 -03:00
Ran Benita
520ff29c07 Merge pull request #12096 from bluetech/staticmethod-instance
python: fix instance handling in static and class method tests
2024-03-10 16:29:06 +02:00
github-actions[bot]
b777b05c0e [automated] Update plugin list (#12098)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-03-10 09:57:13 -03:00
Ran Benita
b90da34a86 Merge pull request #12095 from nicoddemus/cherry-pick-release
Cherry pick release 8.1.1
2024-03-09 19:39:15 +02:00
Ran Benita
0dc0360351 python: fix instance handling in static and class method tests
and also fixes a regression in pytest 8.0.0 where `setup_method` crashes
if the class has static or class method tests.

It is allowed to have a test class with static/class methods which
request non-static/class method fixtures (including `setup_method`
xunit-fixture). I take it as a given that we need to support this
somewhat odd scenario (stdlib unittest also supports it).

This raises a question -- when a staticmethod test requests a bound
fixture, what is that fixture's `self`?

stdlib unittest says - a fresh instance for the test.

Previously, pytest said - some instance that is shared by all
static/class methods. This is definitely broken since it breaks test
isolation.

Change pytest to behave like stdlib unittest here.

In practice, this means stopping to rely on `self.obj.__self__` to get
to the instance from the test function's binding. This doesn't work
because staticmethods are not bound to anything.

Instead, keep the instance explicitly and use that.

BTW, I think this will allow us to change `Class`'s fixture collection
(`parsefactories`) to happen on the class itself instead of a class
instance, allowing us to avoid one class instantiation. But needs more
work.

Fixes #12065.
2024-03-09 19:35:54 +02:00
Bruno Oliveira
140c777590 Merge pull request #12094 from pytest-dev/release-8.1.1
Prepare release 8.1.1

(cherry picked from commit abb0cf4922)
2024-03-09 08:52:31 -03:00
Ran Benita
774f0c44e6 fixtures: only call instance property once in function
No need to compute the property multiple times.
2024-03-09 10:16:41 +02:00
Ran Benita
006058f1f9 fixtures: update outdated comment
No longer does unittest stuff. Also the rest of the sentence is not
really necessary for a docstring.
2024-03-09 10:16:41 +02:00
Ran Benita
437eb86edd Merge pull request #12092 from bluetech/fixture-cleanup
fixtures: a few more cleanups
2024-03-09 08:55:37 +02:00
Levon Saldamli
9033d4d3ff Parse args from file (#12085)
Co-authored-by: Ran Benita <ran@unusedvar.com>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-03-09 08:51:52 +02:00
Bruno Oliveira
2ccc73be9a Merge pull request #12087 from nicoddemus/revert-path-deprecations
Revert legacy path removals
2024-03-08 20:06:47 -03:00
Ran Benita
ff551b7685 fixtures: simplify a bit of code 2024-03-09 00:02:06 +02:00
Ran Benita
f5de111357 fixtures: check scope mismatch in getfixturevalue already-cached case
This makes sure the scope is always compatible, and also allows using
`getfixturevalue` in `pytest_fixture_setup` so less internal magic.
2024-03-09 00:02:06 +02:00
Ran Benita
71671f60b5 fixtures: improve fixture scope mismatch message
- Separate the requesting from the requested.

- Avoid the term "factory", I think most people don't distinguish
  between "fixture" and "fixture function" (i.e. "factory") and would
  find the term "factory" unfamiliar.
2024-03-09 00:02:06 +02:00
Ran Benita
a9d1f55a0f fixtures: simplify scope checking
There are two non-optimal things in the current way scope checking is
done:

- It runs on `SubRequest`, but doesn't use the `SubRequest's scope,
  which is confusing. Instead it takes `invoking_scope` and
  `requested_scope`.

- Because `_check_scope` is only defined on `SubRequest` and not
  `TopRequest`, `_compute_fixture_value` first creates the `SubRequest`
  only then checks the scope (hence the need for the previous point).

Instead, also define `_check_scope` on `TopRequest` (always valid), and
remove `invoking_scope`, using `self._scope` instead.
2024-03-09 00:02:06 +02:00
Ran Benita
83887c066b Merge pull request #12089 from bluetech/unittest-obj
unittest: make `obj` work more like `Function`/`Class`
2024-03-08 20:50:27 +02:00
Ran Benita
4a8bd5f2e2 Merge pull request #12057 from pytest-dev/dependabot/github_actions/pypa/gh-action-pypi-publish-1.8.12
build(deps): Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12
2024-03-08 14:07:30 +02:00
Ran Benita
51595d9000 Merge pull request #12056 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-24.3.0
build(deps): Bump twisted from 23.10.0 to 24.3.0 in /testing/plugins_integration
2024-03-08 14:07:02 +02:00
Ran Benita
1a5e0eb71d unittest: make obj work more like Function/Class
Previously, the `obj` of a `TestCaseFunction` (the unittest plugin item
type) was the unbound method. This is unlike regular `Class` where the
`obj` is a bound method to a fresh instance.

This difference necessitated several special cases in in places outside
of the unittest plugin, such as `FixtureDef` and `FixtureRequest`, and
made things a bit harder to understand.

Instead, match how the python plugin does it, including collecting
fixtures from a fresh instance.

The downside is that now this instance for fixture-collection is kept
around in memory, but it's the same as `Class` so nothing new. Users
should only initialize stuff in `setUp`/`setUpClass` and similar
methods, and not in `__init__` which is generally off-limits in
`TestCase` subclasses.

I am not sure why there was a difference in the first place, though I
will say the previous unittest approach is probably the preferable one,
but first let's get consistency.
2024-03-08 14:03:26 +02:00
Bruno Oliveira
221097517b Add changelog entry for #12069 2024-03-07 19:50:33 -03:00
Bruno Oliveira
dacee1f11d Revert "Remove deprecated py.path hook arguments"
This reverts commit a98f02d423.
2024-03-07 19:50:33 -03:00
Bruno Oliveira
303cd0d48a Revert "Remove deprecated py.path (fspath) node constructor arguments"
This reverts commit 6c89f9261c.
2024-03-07 19:50:33 -03:00
Bruno Oliveira
86945f9a1f Rename 'testing' extra to 'dev' (#12052)
Minor, but seems `dev` is more standard for the development extras than `testing`, being the default for tools like `poetry`.
2024-03-07 19:12:19 -03:00
Bruno Oliveira
03e54712dd Do not import duplicated modules with --importmode=importlib (#12074)
Regression brought up by #11475.
2024-03-04 12:44:56 -03:00
Bruno Oliveira
18c0e5075f Merge pull request #12075 from nicoddemus/yank-8.1.0
Yank version 8.1.0
2024-03-04 12:21:12 -03:00
Bruno Oliveira
6ee02a3e6c Yank version 8.1.0
Related to #12069
2024-03-04 12:18:14 -03:00
Bruno Oliveira
0951cbc6e4 Merge pull request #12070 from RonnyPfannschmidt/lift
add myself as tidelifter
2024-03-04 10:01:53 -03:00
Ronny Pfannschmidt
37b3401091 add myself to tidelift 2024-03-04 12:59:54 +01:00
dependabot[bot]
13558b9f53 build(deps): Bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.11 to 1.8.12.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.11...v1.8.12)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 03:47:21 +00:00
dependabot[bot]
23bdc643c9 build(deps): Bump twisted in /testing/plugins_integration
Bumps [twisted](https://github.com/twisted/twisted) from 23.10.0 to 24.3.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-23.10.0...twisted-24.3.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 03:25:34 +00:00
Ran Benita
71849cc05c Merge pull request #12055 from bluetech/cherry-pick-release
Cherry-pick 8.1.0 release notes
2024-03-03 23:29:47 +02:00
Ran Benita
e410705561 Cherry-pick 8.1.0 release notes
(cherry picked from commit 0a536810dc)
2024-03-03 23:27:02 +02:00
Ran Benita
00043f7f10 Merge pull request #12038 from bluetech/fixtures-rm-arg2index
fixtures: avoid mutable arg2index state in favor of looking up the request chain
2024-03-03 15:45:34 +02:00
Ran Benita
f4e10251a4 Merge pull request #12048 from bluetech/fixture-teardown-excgroup
fixtures: use exception group when multiple finalizers raise in fixture teardown
2024-03-03 15:09:36 +02:00
Ran Benita
43492f5707 Merge pull request #12051 from jakkdl/test_debugging_pythonbreakpoint
[minor/QoL] monkeypatch.delenv PYTHONBREAKPOINT in two tests that previously failed/skipped
2024-03-03 15:07:19 +02:00
github-actions[bot]
82fe28dae4 [automated] Update plugin list (#12049)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-03-03 12:50:42 +00:00
jakkdl
5e2ee7175c monkeypatch.delenv PYTHONBREAKPOINT in two tests that previously failed/skipped 2024-03-03 13:48:29 +01:00
Bruno Oliveira
89ee4493cc Merge pull request #11997 from nicoddemus/11475-importlib
Change importlib to first try to import modules using the standard mechanism
2024-03-03 09:43:14 -03:00
mrbean-bremen
8248946a55 Do not collect symlinked tests under Windows (#12050)
The check for short paths under Windows via os.path.samefile, introduced in #11936, also found similar tests in symlinked tests in the GH Actions CI.

Fixes #12039.

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-03-03 09:41:31 -03:00
Ran Benita
434282e17f fixtures: use exception group when multiple finalizers raise in fixture teardown
Previously, if more than one fixture finalizer raised, only the first
was reported, and the other errors were lost.

Use an exception group to report them all. This is similar to the change
we made in node teardowns (in `SetupState`).
2024-03-02 23:39:11 +02:00
Bruno Oliveira
d6134bc21e doc: document consider_namespace_packages option 2024-03-02 16:13:48 -03:00
Bruno Oliveira
aac720abc9 testing/test_pathlib: parametrize namespace package option
Test with namespace packages support even when it will not find namespace packages to ensure it will at least not give weird results or crashes.
2024-03-02 16:13:48 -03:00
Bruno Oliveira
111c0d910e Add consider_namespace_packages ini option
Fix #11475
2024-03-02 16:13:48 -03:00
Bruno Oliveira
199d4e2b73 pathlib: import signature and docs for import_path 2024-03-02 16:13:48 -03:00
Bruno Oliveira
5746b8e696 doc: update and improve import mode docs 2024-03-02 16:13:48 -03:00
Bruno Oliveira
c85fce39b6 Change importlib to first try to import modules using the standard mechanism
As detailed in
https://github.com/pytest-dev/pytest/issues/11475#issuecomment-1937043670,
currently with `--import-mode=importlib` pytest will try to import every
file by using a unique module name, regardless if that module could be
imported using the normal import mechanism without touching `sys.path`.

This has the consequence that non-test modules available in `sys.path`
(via other mechanism, such as being installed into a virtualenv,
PYTHONPATH, etc) would end up being imported as standalone modules,
instead of imported with their expected module names.

To illustrate:

```
.env/
  lib/
    site-packages/
      anndata/
        core.py
```

Given `anndata` is installed into the virtual environment, `python -c
"import anndata.core"` works, but pytest with `importlib` mode would
import that module as a standalone module named
`".env.lib.site-packages.anndata.core"`, because importlib module was
designed to import test files which are not reachable from `sys.path`,
but now it is clear that normal modules should be imported using the
standard mechanisms if possible.

Now `imporlib` mode will first try to import the module normally,
without changing `sys.path`, and if that fails it falls back to
importing the module as a standalone module.

This also makes `importlib` respect namespace packages.

This supersedes #11931.

Fix #11475
Close #11931
2024-03-02 16:13:48 -03:00
Bruno Oliveira
067daf9f7d pathlib: consider namespace packages in resolve_pkg_root_and_module_name
This applies to `append` and `prepend` import modes; support for
`importlib` mode will be added in a separate change.
2024-03-02 16:13:48 -03:00
Bruno Oliveira
5867426455 pathlib: handle filenames starting with . in module_name_from_path 2024-03-02 16:13:48 -03:00
Bruno Oliveira
4dea18308b pathlib: extract a function _import_module_using_spec
Will be reused.
2024-03-02 16:13:48 -03:00
Bruno Oliveira
7524e60d8f pathlib: extract a function resolve_pkg_root_and_module_name
Will be reused.
2024-03-02 16:13:48 -03:00
Bruno Oliveira
dcf01fd39a testing/test_pathlib: add an importlib test
Ensure the implementation isn't changed to trigger such a bug.
2024-03-02 16:13:48 -03:00
Bruno Oliveira
300ceb435e testing/test_doctest: make test_importmode more realistic 2024-03-02 16:13:48 -03:00
Bruno Oliveira
887e251abb testing/test_pathlib: remove test_issue131_on__init__
The test seems wrong, and we haven't been able to figure out what it's
trying to test (the original issue is lost in time).
2024-03-02 16:13:48 -03:00
Ran Benita
6ed005161d Merge pull request #12043 from bluetech/pyargs-root
Fix collection failures due to permission errors when using `--pyargs`
2024-03-02 21:09:20 +02:00
Ran Benita
31026a2df2 main: only include package parents in collection tree for --pyargs collection arguments
(diff better viewed ignoring whitespace)

In pytest<8, the collection tree for `pyargs` arguments in an invocation
like this:

    pytest --collect-only --pyargs pyflakes.test.test_undefined_names

looked like this:

```
<Package test>
  <Module test_undefined_names.py>
    <UnitTestCase Test>
      <TestCaseFunction test_annotationUndefined>
      ... snipped ...
```

The pytest 8 collection improvements changed it to this:

```
<Dir pytest>
  <Dir .tox>
    <Dir venv>
      <Dir lib>
        <Dir python3.11>
          <Dir site-packages>
            <Package pyflakes>
              <Package test>
                <Module test_undefined_names.py>
                  <UnitTestCase Test>
                    <TestCaseFunction test_annotationUndefined>
                    ... snipped ...
```

Besides being egregious (and potentially even worse than the above,
going all the way to the root, for system-installed packages, as is
apparently common in CI), this also caused permission errors when trying
to probe some of those intermediate directories.

This change makes `--pyargs` arguments no longer try to add parent
directories to the collection tree according to the `--confcutdir` like
they're regular arguments. Instead, only add the parents that are in the
import path. This now looks like this:

```
<Package .tox/venv/lib/python3.11/site-packages/pyflakes>
  <Package test>
    <Module test_undefined_names.py>
      <UnitTestCase Test>
        <TestCaseFunction test_annotationUndefined>
        ... snipped ...
```

Fix #11904.
2024-03-02 20:26:02 +02:00
Ran Benita
f20e32c982 main: slight refactor to collection argument parents logic
No logical change, preparation for the next commit.
2024-03-02 20:26:02 +02:00
Ran Benita
1612d4e393 main: add module_name to CollectionArgument
This is available when the argument is a `--pyargs` argument (resolved
from a python module path). Will be used in an upcoming commit.
2024-03-02 20:26:02 +02:00
Ran Benita
5e0d11746c main: model the result of resolve_collection_arguments as a dataclass
In preparation of adding more info to it.
2024-03-02 20:25:57 +02:00
Ran Benita
b6bf58abe8 Merge pull request #12042 from donhui/docs-0301
docs: update plugins number
2024-03-01 15:20:33 +02:00
Ran Benita
ff4c3b2873 main: add missing import importlib.util
Used in `resolve_collection_argument`. It's implicitly imported by some
other import, but some type checkers don't recognize this.
2024-03-01 13:28:27 +02:00
donghui
4db5e53709 docs: update plugins number 2024-03-01 05:43:57 +08:00
Ran Benita
c967d508d6 Merge pull request #12037 from bluetech/fixtures-getnextfixturedef-parent
fixtures: remove unneeded optimization from `_getnextfixturedef`
2024-02-28 09:28:15 +02:00
Ran Benita
bd45ccd2ca fixtures: avoid mutable arg2index state in favor of looking up the request chain
pytest allows a fixture to request its own name (directly or
indirectly), in which case the fixture with the same name but one level
up is used.

To know which fixture should be used next, pytest keeps a mutable
item-global dict `_arg2index` which maintains this state. This is not
great:

- Mutable state like this is hard to understand and reason about.

- It is conceptually buggy; the indexing is global (e.g. if requesting
  `fix1` and `fix2`, the indexing is shared between them), but actually
  different branches of the subrequest tree should not affect each
  other.

  This is not an issue in practice because pytest keeps a cache of the
  fixturedefs it resolved anyway (`_fixture_defs`), but if the cache is
  removed it becomes evident.

Instead of the `_arg2index` state, count how many `argname`s deep we are
in the subrequest tree ("the fixture stack") and use that for the index.

This way, no global mutable state and the logic is very localized and
easier to understand.

This is slower, however fixture stacks should not be so deep that this
matters much, I hope.
2024-02-27 22:24:26 +02:00
Ran Benita
c83c1c4bda fixtures: add _iter_chain helper method
Will be reused in the next commit.
2024-02-27 22:24:26 +02:00
Ran Benita
686f9e0720 fixtures: remove unneeded optimization from _getnextfixturedef
According to my understanding, this code, which handles obtaining the
relevant fixturedefs when a dynamic `getfixturevalue` is used, has an
optimization where it only grabs fixturedefs that are visible to the
*parent* of the item, instead of the item itself, under the assumption
that a fixturedef can't be visible to a single item, only to a
collector.

Remove this optimization for the following reasons:
- It doesn't save much (one loop iteration in `matchfactories`)
- It slightly complicates the complex fixtures code
- If some plugin wants to make a fixture visible only to a single item,
  why not let it?
- In the static case (`getfixtureclosure`), this optimization is not
  done (despite the confusing name `parentnode`, it is *not* the parent
  node). This is inconsistent.
2024-02-27 22:22:07 +02:00
dependabot[bot]
98b008ff6c build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#12033)
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/4.2.0...4.3.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  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-02-26 10:51:07 -03:00
Bruno Oliveira
73edefdd64 Merge pull request #12031 from pytest-dev/update-plugin-list/patch-affc652f1
[automated] Update plugin list
2024-02-24 21:50:44 -03:00
Bruno Oliveira
ffd727e9d6 Fix mention of the prefix for pytest plugins in plugin_list 2024-02-24 21:35:51 -03:00
pytest bot
b6eb985d55 [automated] Update plugin list 2024-02-25 00:19:33 +00:00
Ran Benita
affc652f1c Merge pull request #12030 from bluetech/cherry-pick-release
Cherry pick 8.0.2 release notes
2024-02-25 00:31:52 +02:00
Ran Benita
7460b1aa31 Cherry pick 8.0.2 release notes
(cherry picked from commit e53f798932)
2024-02-25 00:25:49 +02:00
Patrick Lannigan
84bd31de64 New verbosity_test_case ini option (#11653)
Allow for the output of test case execution to be controlled independently from the application verbosity level. 

`verbosity_test_case` is the new ini setting to adjust this functionality.

Fix #11639
2024-02-24 16:27:54 -03:00
Ran Benita
a2a9aa6cde Merge pull request #12027 from bluetech/sys-last-exc
runner: add support for `sys.last_exc` for post-mortem debugging on Python>=3.12
2024-02-23 22:41:14 +02:00
robotherapist
c09f74619b runner: add support for sys.last_exc for post-mortem debugging on Python>=3.12
Fix #11850
2024-02-23 15:59:32 +02:00
Ran Benita
b510adf9ef Merge pull request #12023 from bluetech/fixtures-cleanups-2
fixtures: remove an unneeded suppress
2024-02-23 15:35:17 +02:00
Ran Benita
93cd7ba857 Merge pull request #12022 from bluetech/revert-11721
Revert "Fix teardown error reporting when `--maxfail=1` (#11721)"
2024-02-23 15:34:32 +02:00
Bruno Oliveira
8d9b95dcdb Fix collection of short paths on Windows (#11936)
Passing a short path in the command line was causing the matchparts check to fail, because ``Path(short_path) != Path(long_path)``.

Using ``os.path.samefile`` as fallback ensures the comparsion works on Windows when comparing short/long paths.

Fix #11895
2024-02-23 07:51:15 -03:00
Ran Benita
ad651ddfce fixtures: remove an unneeded suppress
In `CallSpec2.setmulti` the `params` and `_arg2scope` dicts are always
set together.

Further, the `get_parametrized_fixture_keys` accesses `_arg2scope` for
all argnames without a check, which I think rules out that the code
protects against plugin shenanigans.

After removing the suppress, adjust the comment and code to make more
sense.
2024-02-23 11:51:49 +02:00
Ran Benita
00d9640abc Revert "Fix teardown error reporting when --maxfail=1 (#11721)"
Fix #12021.
Reopens #11706.

This reverts commit 12b9bd5801.

This change caused a bad regression in pytest-xdist:
https://github.com/pytest-dev/pytest-xdist/issues/1024

pytest-xdist necessarily has special handling of `--maxfail` and session
fixture teardown get executed multiple times with the change.

Since I'm not sure how to adapt pytest-xdist myself, revert for now.

I kept the sticky `shouldstop`/`shouldfail` changes as they are good
ideas regardless I think.
2024-02-23 11:45:26 +02:00
Ran Benita
010ce2ab0f Add typing to from_parent return values (#11916)
Up to now the return values of `from_parent` were untyped, this is an
attempt to make it work with `typing.Self`.
2024-02-22 23:35:57 -08:00
Eric Larson
1640f2e454 ENH: Improve warning stacklevel (#12014)
* ENH: Improve warning stacklevel

* TST: Add test

* TST: Ping

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* MAINT: Changelog

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-22 22:11:05 -08:00
Bruno Oliveira
59e9a58cc9 Remove Anthony from Tidelift participants (#12020)
As discussed in the core development channels, @asottile asked to no longer be a Tidelift participant, at least for the time being.
2024-02-22 21:04:11 -03:00
Ran Benita
691d8fcafb Merge pull request #12019 from bluetech/fixtures-simplify
fixtures: remove a no longer needed sort
2024-02-22 21:52:56 +02:00
Ben Leith
c5c729e27a Add --log-file-mode option to the logging plugin, enabling appending to log-files (#11979)
Previously, the mode was hard-coded to be "w" which truncates the file before logging.

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-02-21 12:02:19 +00:00
Ran Benita
9bea1be215 fixtures: remove a no longer needed sort
Dicts these days preserve order, so the sort is no longer needed to
achieve determinism.

As shown by the `test_dynamic_parametrized_ordering` test, this can
change the ordering of items, but only in equivalent ways (same number
of setups/teardowns per scope), it will just respect the user's given
ordering better (hence `vxlan` items now ordered before `vlan` items
compared to the previous ordering).
2024-02-21 10:17:25 +02:00
Ran Benita
2007cf6296 fixtures: remove a level of indentation
A bit easier to follow.
2024-02-21 10:17:24 +02:00
Ran Benita
79def57cc6 python: small code cleanup 2024-02-21 10:17:24 +02:00
Ran Benita
8a410d0ba6 Merge pull request #12013 from bluetech/doctest-test
testing: add a regression test for `setup_module` + `--doctest-modules`
2024-02-20 22:22:01 +02:00
Ran Benita
a37cff3ca8 testing: add a regression test for setup_module + --doctest-modules
Refs #12011 (only fails on 8.0.1, not main).
2024-02-20 09:36:00 +02:00
pre-commit-ci[bot]
95f21f96cc [pre-commit.ci] pre-commit autoupdate (#12012)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.1 → v0.2.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.1...v0.2.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-19 21:36:03 -03:00
Bruno Oliveira
998fee1679 Clarify PytestPluginManager._is_in_confcutdir (#12007)
Follow up to #12006, let's put some comments clarifying `is_in_confcutdir` semantics, as this is not the first time someone misunderstands it.

Also removed an obsolete comment in `_loadconftestmodules`: we already set the `confcutdir` based on `rootdir`/`initfile` if not explicitly given.

Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-02-18 17:27:47 -03:00
Bruno Oliveira
40011b838b Allow Sphinx 7.x (#12002)
Thanks to https://github.com/pytest-dev/pytest/issues/11988#issuecomment-1950318888, the problem was our custom template.

The solution was to copy the template from Sphinx 7 and remove the header.
2024-02-18 07:21:05 -03:00
Bruno Oliveira
b37696703b Merge pull request #12003 from pytest-dev/update-plugin-list/patch-cefb3e227
[automated] Update plugin list
2024-02-17 22:35:26 -03:00
Bruno Oliveira
abf6a60567 Fix 'pytest_' mention: it was being considered a rst reference 2024-02-17 22:21:30 -03:00
pytest bot
52da8dd66c [automated] Update plugin list 2024-02-18 00:19:26 +00:00
Bruno Oliveira
cefb3e2277 Disallow Sphinx 6 and 7 (#12000)
Using Sphinx 6.x and 7.x the search bar disappears. Restrict to Sphinx 5.x for now until we find a solution.

Reverts #11568
Fixes #11988
2024-02-17 17:46:58 -03:00
Bruno Oliveira
5f241f388b Revert sys.platform verification to simple comparison (#11998)
As the comment above it states, we need to keep the comparison simple so mypy can understand it, otherwise it will fail to properly handle this on Windows and will flag ``os.getuid()`` missing.
2024-02-17 16:10:21 -03:00
Ran Benita
aebeb33137 Merge pull request #11996 from bluetech/getstatementrange-index-error
code: fix `IndexError` crash in `getstatementrange_ast`
2024-02-17 18:59:10 +02:00
Ran Benita
9f13d41d7b code: fix IndexError crash in getstatementrange_ast
Fix #11953.
2024-02-17 18:43:55 +02:00
Ran Benita
984478109f Merge pull request #11995 from bluetech/cherry-pick-release
Cherry pick 8.0.1 release notes
2024-02-17 00:27:55 +02:00
Ran Benita
22b541e4eb Merge pull request #11993 from pytest-dev/release-8.0.1
Prepare release 8.0.1

(cherry picked from commit 68524d4858)
2024-02-17 00:11:27 +02:00
Ran Benita
fbe18fc7a9 Merge pull request #11991 from bluetech/warns-fix
recwarn: fix pytest.warns handling of Warnings with multiple arguments
2024-02-16 14:29:19 +02:00
Reagan Lee
9b838f491f recwarn: fix pytest.warns handling of Warnings with multiple arguments
Fix #11906
2024-02-16 14:14:24 +02:00
Ran Benita
6ef0cf150a Merge pull request #11959 from eerovaher/warn-message-type
Allow using `warnings.warn()` with a `Warning`
2024-02-16 14:00:37 +02:00
Eero Vaher
0475b1c925 Allow using warnings.warn() with Warnings
Test:

`warnings.warn()` expects that its first argument is a `str` or a
`Warning`, but since 9454fc38d3
`pytest.warns()` no longer allows `Warning` instances unless the first
argument the `Warning` was initialized with is a `str`. Furthermore, if
the `Warning` was created without arguments then `pytest.warns()` raises
an unexpected `IndexError`. The new tests reveal the problem.

Fix:

`pytest.warns()` now allows using `warnings.warn()` with a `Warning`
instance, as is required by Python, with one exception. If the warning
used is a `UserWarning` that was created by passing it arguments and the
first argument was not a `str` then `pytest.raises()` still considers
that an error. This is because if an invalid type was used in
`warnings.warn()` then Python creates a `UserWarning` anyways and it
becomes impossible for `pytest` to figure out if that was done
automatically or not.

[ran: rebased on previous commit]
2024-02-16 13:41:59 +02:00
Ran Benita
dcf9da92be recwarn: minor style improvements
In preparation for next commit.
2024-02-16 13:41:27 +02:00
Ran Benita
8e56795b77 Merge pull request #11989 from bluetech/plugin-list-underscore
scripts/update-plugin-list: include packages starting with "pytest_" (underscore)
2024-02-16 13:01:25 +02:00
Ran Benita
718cd40015 Merge pull request #11920 from bluetech/warn-skip
recwarn: let base exceptions propagate through `pytest.warns` again
2024-02-16 12:22:52 +02:00
Ran Benita
288201b8f5 recwarn: let base exceptions propagate through pytest.warns again
Fix #11907.
2024-02-16 12:07:56 +02:00
Ran Benita
c6313a06fb scripts/update-plugin-list: include packages starting with "pytest_" (underscore)
Fix #11985.
2024-02-16 12:03:38 +02:00
dependabot[bot]
5d7a5a9343 build(deps): Bump codecov/codecov-action from 3 to 4 (#11921)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-14 16:11:30 -03:00
dependabot[bot]
cbb5c82c39 build(deps): Bump peter-evans/create-pull-request from 5.0.2 to 6.0.0 (#11922)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5.0.2 to 6.0.0.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](153407881e...b1ddad2c99)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-14 16:11:20 -03:00
Bruno Oliveira
acafd003aa Consider pyproject.toml files for config if no other config files were found (#11962)
Today `pyproject.toml` is the standard for declaring a Python project root, so seems reasonable to consider it for the ini configuration (and specially `rootdir`) in case we do not find other suitable candidates.

Related to #11311
2024-02-14 16:08:45 -03:00
Bruno Oliveira
46e6fb12c7 Consider paths and pathlists relative to cwd in case of an absent ini-file (#11963)
Previously this would trigger an `AssertionError`.

While it could be considered a bug-fix, but given it now can be relied upon, it is probably better to consider it an improvement.

Fix #11311
2024-02-14 15:53:28 -03:00
Dave Hall
fe7907d78c Add logot to plugin list (#11972) 2024-02-14 15:50:34 -03:00
Ran Benita
5bb1363435 Merge pull request #11957 from bluetech/fix-session-collect-order
main: fix reversed collection order in Session
2024-02-13 09:44:13 +02:00
pre-commit-ci[bot]
ca84327f15 [pre-commit.ci] pre-commit autoupdate (#11967)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.0 → v0.2.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.0...v0.2.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-13 06:19:40 +01:00
dependabot[bot]
3b798e5422 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#11965)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.3 to 0.23.5.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.3...v0.23.5)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-12 11:06:14 -03:00
Pierre Sassoulas
526b971221 Merge pull request #11961 Add some autofixable refactor rules from pylint 2024-02-11 19:52:29 +01:00
github-actions[bot]
23dfb52974 [automated] Update plugin list (#11964)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-02-10 21:50:24 -03:00
Pierre Sassoulas
7da04c963f [ruff] Add unwanted pylint message to the ignore list 2024-02-10 23:42:36 +01:00
Pierre Sassoulas
b922270ce7 [performance] Micro-optimization in '_traceback_filter'
Should be around 40% faster according to this simplified small benchmark:

python -m timeit "a=[0, 1, 2, 3, 4];b=list((e if i in {0, len(a) -1} else str(e)) for i, e in enumerate(a))"
200000 loops, best of 5: 1.12 usec per loop
python -m timeit "a=[0, 1, 2, 3, 4];b=list((a[0], *(str(e) for e in a[1:-1]), a[-1]))"
500000 loops, best of 5: 651 nsec per loop

python -m timeit "a=[0, 1, 2, 3, 4,5,6,7,8,9,10,11,12,13,14,15,16];b=list((e if i in {0, len(a) -1} else str(e)) for i, e in enumerate(a))"
100000 loops, best of 5: 3.31 usec per loop
python -m timeit "a=[0, 1, 2, 3, 4,5,6,7,8,9,10,11,12,13,14,15,16];b=list((a[0], *(str(e) for e in a[1:-1]), a[-1]))"
200000 loops, best of 5: 1.72 usec per loop
2024-02-10 20:23:48 +01:00
Pierre Sassoulas
1180348303 [ruff] Add 'consider-using-in' from pylint
See https://pylint.readthedocs.io/en/latest/user_guide/messages/refactor/consider-using-in.html
An automated fix from ruff is available (but it's unsafe for now).
2024-02-10 15:47:44 +01:00
Florian Bruhin
7690a0ddf1 Improve error message when using @pytest.fixture twice (#11670)
* Improve error message when using @pytest.fixture twice

While obvious in hindsight, this error message confused me. I thought my fixture
function was used in a test function twice, since the wording is ambiguous.

Also, the error does not tell me *which* function is the culprit.

Finally, this adds a test, which wasn't done in
cfd16d0dac where this was originally implemented.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-02-09 14:59:04 +01:00
Ran Benita
29a5f94428 Merge pull request #11956 from bluetech/ruff-warning
Fix ruff deprecation warning + enable few more rules
2024-02-09 15:32:11 +02:00
Ran Benita
ea57c40c43 main: fix reversed collection order in Session
Since we're working with a stack (last in first out), we need to append
to it in reverse to preserve the order when popped.

Fix #11937.
2024-02-09 15:24:44 +02:00
Ran Benita
a182e10b06 Enable lint PGH004 - Use specific rule codes when using noqa 2024-02-09 11:14:36 +02:00
Ran Benita
d1ee6d154f Enable flake8-pie 2024-02-09 11:08:33 +02:00
Ran Benita
d02618d173 Fix ruff deprecation warning
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`:
  - 'ignore' -> 'lint.ignore'
  - 'select' -> 'lint.select'
2024-02-09 10:48:05 +02:00
whysage
9454fc38d3 closes: 10865 Fix muted exception (#11804)
* feat: 10865

* feat: 10865 refactor code and tests

* feat: 10865 add test skip for pypy

* feat: 10865 add test with valid warning

* feat: 10865 fix v2 for codecov

* feat: 10865 fix conflict
2024-02-07 16:47:56 -08:00
Ran Benita
101328aba5 Merge pull request #11947 from bluetech/hypothesis-revert
Revert "testing: temporarily disable test due to hypothesis issue (#1836)"
2024-02-07 22:44:58 +02:00
Ran Benita
42785cca44 Revert "testing: temporarily disable test due to hypothesis issue (#11836)"
This reverts commit 5cd0535395.
2024-02-07 22:13:23 +02:00
Ran Benita
6c0b6c2f92 Merge pull request #11941 from bluetech/doctest-parsefactories
doctest: fix autouse fixtures possibly not getting picked up
2024-02-07 22:09:17 +02:00
Ran Benita
9cd14b4ffb doctest: fix autouse fixtures possibly not getting picked up
Fix #11929.

Figured out what's going on. We have the following collection tree:

```
<Dir pyspacewar>
  <Dir src>
    <Package pyspacewar>
      <Package tests>
        <DoctestModule test_main.py>
          <DoctestItem pyspacewar.tests.test_main.doctest_main>
```

And the `test_main.py` contains an autouse fixture (`fake_game_ui`) that
`doctest_main` needs in order to run properly. The fixture doesn't run!
It doesn't run because nothing collects the fixtures from (calls
`parsefactories()` on) the `test_main.py` `DoctestModule`.

How come it only started happening with commit
ab63ebb3dc07b89670b96ae97044f48406c44fa0? Turns out it mostly only
worked accidentally. Each `DoctestModule` is also collected as a normal
`Module`, with the `Module` collected after the `DoctestModule`. For
example, if we add a non-doctest test to `test_main.py`, the collection
tree looks like this:

```
<Dir pyspacewar>
  <Dir src>
    <Package pyspacewar>
      <Package tests>
        <DoctestModule test_main.py>
          <DoctestItem pyspacewar.tests.test_main.doctest_main>
        <Module test_main.py>
          <Function test_it>
```

Now, `Module` *does* collect fixtures. When autouse fixtures are
collected, they are added to the `_nodeid_autousenames` dict.

Before ab63ebb3dc, `DoctestItem` consults
`_nodeid_autousenames` at *setup* time. At this point, the `Module` has
collected and so it ended up picking the autouse fixture (this relies on
another "accident", that the `DoctestModule` and `Module` have the same
node ID).

After ab63ebb3dc, `DoctestItem` consults
`_nodeid_autousenames` at *collection* time (= when it's created). At
this point, the `Module` hasn't collected yet, so the autouse fixture is
not picked out.

The fix is simple -- have `DoctestModule.collect()` call
`parsefactories`. From some testing I've done it shouldn't have negative
consequences (I hope).
2024-02-07 21:53:51 +02:00
dependabot[bot]
4c894f20a1 build(deps): Bump django in /testing/plugins_integration (#11946)
Bumps [django](https://github.com/django/django) from 5.0 to 5.0.2.
- [Commits](https://github.com/django/django/compare/5.0...5.0.2)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-07 15:37:56 -03:00
Ran Benita
6e5008f19f doctest: don't open code the module import
Currently, `DoctestModule` does `import_path` on its own. This changes
it to use `importtestmodule` as `Module` does. The behavioral changes
are:

- Much better error messages on import errors.

- Handles a few more error cases (see `importtestmodule`). This
  technically expands the cover of `--doctest-ignore-import-errors` but
  I think it makes sense.

- Considers `pytest_plugins` in the module.

- Populates `self.obj` as properly (without double-imports) as is
  expected from a `PyCollector`.

This is also needed for the next commit.
2024-02-06 23:46:23 +02:00
Pierre Sassoulas
b9d02c5b53 Merge pull request #11932 Add pre-commit hook and fix pyproject.toml
- [pyproject-fmt] Add pre-commit hook and autofix existing
- Proper setuptools version for pyproject.toml
2024-02-06 15:14:07 +01:00
Pierre Sassoulas
d1095426c1 Update setuptools version to the one that support pyproject.toml 2024-02-06 14:40:31 +01:00
Pierre Sassoulas
757778f5f6 [pyproject-fmt] Add pre-commit hook and autofix existing 2024-02-06 14:40:31 +01:00
Pierre Sassoulas
404d31a942 Merge pull request #11930 from Pierre-Sassoulas/setup.cfg-to-pyproject.toml
Migration from ``setup.cfg`` to ``pyproject.toml``
2024-02-05 22:40:44 +01:00
Pierre Sassoulas
0d91539614 Merge pull request #11935 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-02-05 21:46:11 +01:00
pre-commit-ci[bot]
835e8032f4 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.15 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.15...v0.2.0)
2024-02-05 20:29:38 +00:00
Pierre Sassoulas
c76ea72331 [pyproject.toml] Moving 'package_data' (py.typed) from setup.cfg 2024-02-05 21:04:33 +01:00
Pierre Sassoulas
dab1583ce1 [pyproject.toml] Remove setup_requires / package_dir in setup.cfg already exists 2024-02-05 21:04:12 +01:00
Pierre Sassoulas
411c2cbf9d [pyproject.toml] Translate dynamic option to pyproject.toml 2024-02-05 21:03:28 +01:00
Pierre Sassoulas
c3583dee0b [pyproject.toml] Translate 'metadata:platforms' to pyproject.toml 2024-02-05 21:03:26 +01:00
Pierre Sassoulas
a1d99e4bdd [pyproject.toml] Move information from setup.cfg to pyproject.toml 2024-02-05 21:02:32 +01:00
Ran Benita
aaa9ca7327 Merge pull request #11918 from pytest-dev/update-plugin-list/patch-20b18f0f9
[automated] Update plugin list
2024-02-05 13:49:09 +02:00
Ran Benita
29094983d7 Merge pull request #11923 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.8.0
build(deps): Bump pytest-django from 4.7.0 to 4.8.0 in /testing/plugins_integration
2024-02-05 13:32:11 +02:00
Ran Benita
b8e56557c6 Merge pull request #11925 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-sugar-1.0.0
build(deps): Bump pytest-sugar from 0.9.7 to 1.0.0 in /testing/plugins_integration
2024-02-05 13:31:50 +02:00
Ran Benita
304ccb4ad7 Merge pull request #11928 from bluetech/setup-cfg-cleanups
Some setup.cfg cleanups
2024-02-05 13:29:49 +02:00
Ran Benita
90634a6060 setup.cfg: remove zip_safe
The setuptools docs say it's obsolete and no longer needed:
https://setuptools.pypa.io/en/latest/deprecated/zip_safe.html#understanding-the-zip-safe-flag
2024-02-05 12:21:37 +02:00
Ran Benita
ccbae95ad4 setup.cfg: remove redundant packages/py_modules
The `package_dir` already achieves this.
2024-02-05 12:16:52 +02:00
Ran Benita
cd9b241047 setup.cfg: remove [devpi:upload] section
Not needed since bfe2cbe875.
2024-02-05 12:08:21 +02:00
Ran Benita
5c67cb2cf5 setup.cfg: remove [check-manifest] section
Not used since 731c35fcab.
2024-02-05 11:59:48 +02:00
Ran Benita
2fc7926bae setup.cfg: remove [build_sphinx] section
Legacy thing that is no longer needed.
2024-02-05 11:59:32 +02:00
Ran Benita
79de84941a setup.cfg: move mypy configuration from setup.cfg to pyproject.toml
TOML is a nicer format than the INI format setup.cfg uses.
2024-02-05 11:59:27 +02:00
Pierre Sassoulas
0d1f4c63fa Merge pull request #11914 - Activate flake8-bugbear and flake8-pyi 2024-02-05 09:37:37 +01:00
dependabot[bot]
2d4e27daf2 build(deps): Bump pytest-sugar in /testing/plugins_integration
Bumps [pytest-sugar](https://github.com/Teemu/pytest-sugar) from 0.9.7 to 1.0.0.
- [Release notes](https://github.com/Teemu/pytest-sugar/releases)
- [Changelog](https://github.com/Teemu/pytest-sugar/blob/main/CHANGES.rst)
- [Commits](https://github.com/Teemu/pytest-sugar/compare/v0.9.7...v1.0.0)

---
updated-dependencies:
- dependency-name: pytest-sugar
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 03:39:30 +00:00
dependabot[bot]
2e50788b6d build(deps): Bump pytest-django in /testing/plugins_integration
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.7.0 to 4.8.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.7.0...v4.8.0)

---
updated-dependencies:
- dependency-name: pytest-django
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 03:39:23 +00:00
Pierre Sassoulas
3101c026b9 [flake8-bugbear] Remove hidden global state to import only once 2024-02-04 23:08:38 +01:00
Pierre Sassoulas
e193a263c7 [flake8-pyi] Add checks for flake8-pyi and fix existing 2024-02-04 19:27:23 +01:00
Pierre Sassoulas
4eb246d4e1 [flake8-bugbear] noqa B023 not bound by design 2024-02-04 19:27:23 +01:00
Pierre Sassoulas
41ff3584d7 [flake8-bugbear] Fixes a B017 we can actually fix and noqa the two others 2024-02-04 19:27:23 +01:00
Pierre Sassoulas
b62d4b3527 [flake8-bugbear] Remove misleading multiple characters in lstrip
See https://pylint.readthedocs.io/en/stable/user_guide/messages/error/bad-str-strip-call.html
2024-02-04 19:27:23 +01:00
Pierre Sassoulas
e7bab63537 [flake8-bugbear] noqa all the useless comparison that are justified 2024-02-04 19:27:23 +01:00
Pierre Sassoulas
52fba25ff9 [flake8-bugbear] Fix all the useless expressions that are justified 2024-02-04 19:27:23 +01:00
Pierre Sassoulas
fcb818b73c [flake8-bugbear] Re-raise all exceptions with proper exception chaining 2024-02-04 19:27:23 +01:00
Pierre Sassoulas
7eef4619d5 [flake8-bugbear] Add checks from flake8 bugbear 2024-02-04 19:27:16 +01:00
Ran Benita
e28f35c296 Merge pull request #11915 from bluetech/compat-string-types
compat: a couple of minor cleanups
2024-02-04 16:51:43 +02:00
pytest bot
b28bb01c4e [automated] Update plugin list 2024-02-04 00:19:52 +00:00
Ran Benita
3ba4095400 compat: inline helpers into ascii_escaped
The helpers don't add much.
2024-02-03 18:42:05 +02:00
Ran Benita
99e8129ba3 compat: get rid of STRING_TYPES
I think it only obfuscates the code, also calling `bytes` a string type
is pretty misleading in Python 3.
2024-02-03 18:38:38 +02:00
Ran Benita
20b18f0f9a Merge pull request #11913 from bluetech/ruff-version-ignore
Ignore isort on _version.py
2024-02-02 21:55:40 +02:00
Ran Benita
cb5f738858 Ignore isort on _version.py
The file is generated. This makes `ruff src/` run cleanly (when not
running through pre-commit).
2024-02-02 21:29:30 +02:00
Pierre Sassoulas
5be64c31cb Merge pull request #11912 from Pierre-Sassoulas/activate-ruff-checks
[pre-commit] Activate ruff checks and fix existing issues
2024-02-02 20:22:18 +01:00
Pierre Sassoulas
233ab89f13 [ruff] Fix all consider [*cats, garfield] instead of cats + [garfield] 2024-02-02 15:18:38 +01:00
Pierre Sassoulas
8967c527ff [ruff] Activate use next(iter(x)) instead of list(x)[0] and fix issue 2024-02-02 15:18:38 +01:00
Pierre Sassoulas
180a16a344 [ruff] Fix ambiguous characters found in string and comment 2024-02-02 15:18:38 +01:00
Pierre Sassoulas
514376fe29 [ruff] Add ruff's check and autofix existing issues 2024-02-02 15:18:38 +01:00
Pierre Sassoulas
bdfc5c80d8 Merge pull request #11901 from Pierre-Sassoulas/migrate-from-isort-to-ruff
Migrate from ``autoflake``, ``black``, ``isort``, ``pyupgrade``, ``flake8`` and ``pydocstyle``, to ``ruff``
2024-02-02 09:42:07 +01:00
Pierre Sassoulas
9ef905e7a0 [.git-blame-ignore-revs] Add migration to ruff/ruff format and blacken-docs 2024's style 2024-02-02 09:28:09 +01:00
Pierre Sassoulas
4588653b24 Migrate from autoflake, black, isort, pyupgrade, flake8 and pydocstyle, to ruff
ruff is faster and handle everything we had prior.

isort configuration done based on the indication from
https://github.com/astral-sh/ruff/issues/4670, previousely based on
reorder-python-import (#11896)

flake8-docstrings was a wrapper around pydocstyle (now archived) that
explicitly asks to use ruff in https://github.com/PyCQA/pydocstyle/pull/658.

flake8-typing-import is useful mainly for project that support python 3.7
and the one useful check will be implemented in https://github.com/astral-sh/ruff/issues/2302

We need to keep blacken-doc because ruff does not handle detection
of python code inside .md and .rst. The direct link to the repo is
now used to avoid a redirection.

Manual fixes:
- Lines that became too long
- % formatting that was not done automatically
- type: ignore that were moved around
- noqa of hard to fix issues (UP031 generally)
- fmt: off and fmt: on that is not really identical
  between black and ruff
- autofix re-order in pre-commit from faster to slower

Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-02-02 09:27:00 +01:00
Pierre Sassoulas
046f64751b Fix a duplicate assignment in test_config.py
Taken from https://github.com/pytest-dev/pytest/pull/11885 that was closed.
2024-01-31 13:59:25 +01:00
Pierre Sassoulas
4546d5445a Upgrade blacken-doc to black's 2024 style (#11899) 2024-01-31 13:53:21 +01:00
Bruno Oliveira
de161f8791 Merge pull request #11896 from nicoddemus/isort
Replace reorder-python-imports by isort due to black incompatibility
2024-01-31 08:04:39 -03:00
Bruno Oliveira
3be2a9d655 Update and rename .gitblameignore to .git-blame-ignore-revs
Seems like `.git-blame-ignore-revs` is the standard used and also automatically detected by GitHub:

https://github.blog/changelog/2022-03-24-ignore-commits-in-the-blame-view-beta/
2024-01-31 07:50:49 -03:00
John Litborn
e885013c6b fix incorrect example for group_contains (#11892) 2024-01-30 12:00:38 -08:00
Bruno Oliveira
8b54596639 Run pre-commit on all files
Running pre-commit on all files after replacing reorder-python-imports by isort.
2024-01-30 16:35:46 -03:00
Bruno Oliveira
899a6cf2ce Replace reorder-python-imports by isort due to black incompatibility
Unfortunately black and reorder-python-imports are no longer compatible, and from the looks of it probably will not be compatible anytime soon:

https://github.com/asottile/reorder-python-imports/issues/367
https://github.com/asottile/reorder-python-imports/issues/366
https://github.com/psf/black/issues/4175

This replaces `reorder-python-imports` by `isort` configured in a way to yield roughtly the same results.

Closes #11885
2024-01-30 16:35:45 -03:00
Clément Robert
407d984142 Fix an edge case where ExceptionInfo._stringify_exception could crash pytest.raises (#11879)
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
2024-01-30 17:20:30 +02:00
Bruno Oliveira
21bec6cfbe Add changelog entry about FixtureManager.getfixtureclosure changing (#11887)
As discussed in #11868.
2024-01-30 09:41:18 -03:00
Bruno Oliveira
cb57bf50b1 Pin back pytest-asyncio to 8.0.0 compatible release (#11889)
The current version (0.23.4) explicitly does not support pytest 8 yet, so we fallback to the previous release in the hope that at least our integration tests pass.
2024-01-30 06:58:22 -03:00
dependabot[bot]
c0dfc45186 build(deps): Bump hynek/build-and-inspect-python-package (#11877)
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v2.0.0...v2.0.1)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-29 10:42:51 -03:00
dependabot[bot]
5855f65d0f build(deps): Bump pytest-asyncio in /testing/plugins_integration (#11878)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.3 to 0.23.4.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.3...v0.23.4)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-29 10:42:27 -03:00
Russell Martin
14d3707818 Catch OSError from getpass.getuser() (#11875)
- Previously, `getpass.getuser()` would leak an ImportError if the
  USERNAME environment variable was not set on Windows because the `pwd`
  module cannot be imported.
- Starting in Python 3.13.0a3, it only raises `OSError`.

Fixes #11874
2024-01-28 23:07:18 -03:00
github-actions[bot]
8853a57532 [automated] Update plugin list (#11867)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-01-28 13:28:28 +00:00
Bruno Oliveira
878af85aef mypy: disallow untyped defs by default (#11862)
Change our mypy configuration to disallow untyped defs by default, which ensures *new* files added to the code base are fully typed.

To avoid having to type-annotate everything now, add `# mypy: allow-untyped-defs` to files which are not fully type annotated yet.

As we fully type annotate those modules, we can then just remove that directive from the top.
2024-01-28 10:12:42 -03:00
Ran Benita
e7b43b2121 Merge pull request #11859 from bluetech/numbered-dir-scandir
pathlib: speed up `make_numbered_dir` given a large tmp root
2024-01-28 00:05:39 +02:00
Ran Benita
d0f427aec4 Merge pull request #11865 from bluetech/cherry-pick-release
Cherry pick 8.0.0 release notes
2024-01-28 00:03:06 +02:00
Ran Benita
c6da0d20d2 Merge pull request #11864 from bluetech/release-8.0.0
Prepare release version 8.0.0

(cherry picked from commit 24c681d4ee)
2024-01-28 00:00:15 +02:00
Dương Quốc Khánh
a164ed6400 logging: avoid rounding microsecond to 1_000_000 (#11861)
Rounding microsecond might cause it to reach `1_000_000`, which raises a TypeError.
2024-01-27 10:40:31 -03:00
Ran Benita
eb9013d42c pathlib: speed up make_numbered_dir given a large tmp root
The function currently uses `find_suffixes` which iterates the entire
directory searching for files with the given suffix. In some cases
though, like in pytest's selftest, the directory can get big:

    $ ls /tmp/pytest-of-ran/pytest-0/
    7686

and iterating it many times can get slow.

This doesn't fix the underlying issue (iterating the directory) but at
least speeds it up a bit by using `os.scandir` instead of
`path.iterdir`. So `make_numbered_dir` is still slow for pytest's
selftests, but reduces ~10s for me.
2024-01-25 19:19:02 +02:00
Ran Benita
ac2cd72e5f Merge pull request #11856 from bluetech/pluggy-unblock
config: use `pluginmanager.unblock` instead of accessing pluggy's internals
2024-01-25 10:42:13 +02:00
Ran Benita
bca4bb0738 config: use pluginmanager.unblock instead of accessing pluggy's internals
The function was added in pluggy 1.4.0.
2024-01-25 10:20:44 +02:00
Ran Benita
2a77f8d88b Merge pull request #11854 from bluetech/runner-inline-2
runner: inline `call_runtest_hook`
2024-01-24 10:36:28 +02:00
Ran Benita
d972957303 hookspec: document conftest behavior for all hooks (#9496)
Have each hook explain how implementing it in conftests works. This is part of the functional specification of a hook.
2024-01-23 16:08:16 +02:00
Joachim B Haga
44bf7a2ec0 Mark some xfails from #10042 as non-strict (#11832)
Related to #10042, some tests in `test_debugging.py` are actually flaky and should not be considered strict xfailures.
2024-01-22 18:29:14 -03:00
Ran Benita
5ab8972bb5 runner: inline call_runtest_hook
- Reduce the common stacktrace by an entry - this is mostly for benefit
  of devs looking at crash logs.

- Reduce 6 slow `ihook` calls per test to 3.
2024-01-22 16:26:55 +02:00
github-actions[bot]
21440521fa [automated] Update plugin list (#11848)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-01-22 10:14:58 -03:00
dependabot[bot]
79ae968131 build(deps): Bump actions/cache from 3 to 4 (#11852)
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-22 10:11:09 -03:00
Ran Benita
c3fc717ff7 Merge pull request #11843 from bluetech/writing-plugins
doc/writing_plugins: correct inaccuracies re. initial conftest loading
2024-01-19 14:30:20 +02:00
clee2000
d71ef04f11 Escape skip reason in junitxml (#11842)
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2024-01-18 22:08:26 -03:00
Ran Benita
111ad26f71 doc/writing_plugins: correct inaccuracies re. initial conftest loading 2024-01-18 22:17:55 +02:00
Ran Benita
2178ee86d7 Merge pull request #11826 from bluetech/no-cwd
Prefer using the invocation dir over CWD
2024-01-18 19:02:37 +02:00
Ran Benita
a6dd90a414 python: use invocation dir instead of cwd in fixture-printing code
We should aim to remove all `cwd()` calls except one, otherwise things
will go bad if the working directory changes. Use the invocation dir
instead.
2024-01-18 12:35:32 +02:00
Ran Benita
676f38d04a findpaths: rely on invocation_dir instead of cwd
We should aim to remove all `cwd()` calls except one, otherwise things
will go bad if the working directory changes. Use the invocation dir
instead.
2024-01-18 12:35:32 +02:00
Ran Benita
212c55218b helpconfig: add invocation dir to debug output
The current WD is not supposed to matter, the invocation dir is what
should be relevant. But keep them both for debugging.
2024-01-18 12:35:32 +02:00
Ran Benita
34fafe4c6b config: avoid Path.cwd() call in _set_initial_conftests
We should aim to remove all `cwd()` calls except one, otherwise things
will go bad if the working directory changes. Use the invocation dir
instead.
2024-01-18 12:35:32 +02:00
faph
eefc9d47fc [DOCS] Clarify tmp_path directory location and retention (#11830)
Fixes #11789 and #11790
2024-01-18 07:21:49 -03:00
Bruno Oliveira
7fd561e4ba Properly attach packages to the GH release notes (#11839)
Follow up to https://github.com/pytest-dev/pytest/pull/11754, noticed that the latest GitHub release does not contain the attached files.

Output log from the action:

```
🤔 Pattern 'dist/*' does not match any files.
```
2024-01-17 22:11:10 +00:00
Ran Benita
da9749cd97 Merge pull request #11838 from bluetech/cherry-pick-release
Prepare release version 8.0.0rc2
2024-01-17 23:53:41 +02:00
Ran Benita
ca5bbd0a9f Merge pull request #11835 from pytest-dev/release-8.0.0rc2
Prepare release version 8.0.0rc2

(cherry picked from commit 97960bdd14)
2024-01-17 23:45:21 +02:00
Ran Benita
5cd0535395 testing: temporarily disable test due to hypothesis issue (#11836)
Ref: https://github.com/pytest-dev/pytest/pull/11825#issuecomment-1894094641
2024-01-17 22:53:04 +02:00
Ran Benita
0f5aa5a7d2 Merge pull request #11825 from woutdenolf/fix_missing_fixture_issue
avoid using __file__ in pytest_plugin_registered as can be wrong on Windows
2024-01-17 15:29:29 +02:00
Ran Benita
9ea2e0a79f fixtures: avoid slow pm.get_name(plugin) call by using the new plugin_name hook parameter 2024-01-17 15:06:45 +02:00
Ran Benita
0f5ecd83c4 hookspecs: add plugin_name parameter to the pytest_plugin_registered hook
We have a use case for this in the next commit.

The name can be obtained by using `manager.get_name(plugin)`, however
this is currently O(num plugins) in pluggy, which would be good to
avoid. Besides, it seems generally useful.
2024-01-17 15:06:42 +02:00
Ran Benita
6b9bba2edb pre-commit: add pluggy to mypy deps
Otherwise mypy doesn't fully recognize pluggy's typing for some reason
or another.
2024-01-17 15:01:55 +02:00
woutdenolf
6e9f566d79 avoid using __file__ in pytest_plugin_registered as can be wrong on Windows 2024-01-17 15:01:04 +02:00
Ran Benita
a6708b9254 Merge pull request #11822 from bluetech/doc-hookspec
hookspec: minor doc tweaks
2024-01-16 18:34:33 +02:00
Florian Bruhin
e895c9d38c doc: Remove sold out training (#11823) 2024-01-16 14:53:10 +01:00
Ran Benita
c973ccb622 hookspec: modernize a reference 2024-01-15 23:47:19 +02:00
Ran Benita
dd1447cfe5 hookspec: move pytest_load_initial_conftests up
Reflect the order in which the plugins are called.
2024-01-15 23:46:07 +02:00
Ran Benita
9ad8b9fc36 hookspec: remove explicit :param types
Duplicates info in the type annotations which sphinx understands.
2024-01-15 23:35:53 +02:00
Florian Bruhin
348e6de102 doc: Update training dates and add pytest sprint (#11819) 2024-01-15 21:04:08 +01:00
Ran Benita
9af6d46371 Merge pull request #11817 from bluetech/conftesterror-cleanup
config: stop using exception triplets in `ConftestImportError`
2024-01-15 13:26:46 +02:00
Ran Benita
e1074f9c3d config: stop using exception triplets in ConftestImportError
In recent python versions all of the info is on the exception object
itself so no reason to deal with the annoying tuple.
2024-01-15 09:47:55 +02:00
Ran Benita
6e74601466 Merge pull request #11815 from bluetech/iter_parents-rename
nodes: rename `iterparents()` -> `iter_parents()`
2024-01-15 09:46:59 +02:00
Ronny Pfannschmidt
3acbdc2f79 Merge pull request #11814 from bluetech/pycache-ignore-collect
main,python: move `__pycache__` ignore to `pytest_ignore_collect`
2024-01-14 17:26:34 +01:00
Ran Benita
707642ad35 nodes: rename iterparents() -> iter_parents()
After the fact I remembered there is `node.iter_markers()` so let's be
consistent with that rather than with `listchain()`.
2024-01-14 15:17:41 +02:00
Ran Benita
2413d1b214 main,python: move __pycache__ ignore to pytest_ignore_collect
This removes one thing that directory collectors need to worry about.

This adds one hook dispatch per `__pycache__` file, but I think it's
worth it for consistency.
2024-01-14 15:05:15 +02:00
Ran Benita
2bb0eca347 Merge pull request #11795 from lesteve/improve-assert-mod-not-in-mods-error-message
Improve assert mod not in mods error message
2024-01-14 13:39:14 +02:00
Loïc Estève
1c9d6834fd Improve assert mod not in mods error message
[ran: tweaked message, made the formatting lazy]
2024-01-14 13:21:54 +02:00
github-actions[bot]
c6ed86453f [automated] Update plugin list (#11811)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-01-14 01:04:53 -03:00
Ran Benita
e403bbf1a9 Merge pull request #11708 from fcharras/FIX/crash_during_conftest_collection
FIX key formating divergence when inspecting plugin dictionary.
2024-01-13 21:45:36 +02:00
Franck Charras
a7c2549321 Fix assert mod not in mods crash
Fix #27806.

Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2024-01-13 20:19:28 +02:00
Ran Benita
d65bcd9a3b Merge pull request #11808 from bluetech/doctest-conftest
doctest: remove special conftest handling
2024-01-13 19:50:20 +02:00
Ran Benita
06dbd3c21c doctest: remove special conftest handling
(Diff better viewed ignoring whitespace)

Since e1c66ab0ad, conftest loading is
handled at the directory level before sub-nodes are collected, so there
is no need for the doctest plugin to handle it specially.

This was probably the case even before
e1c66ab0ad, but I haven't verified this.
2024-01-13 11:18:41 +02:00
Ran Benita
1b78de4e21 Merge pull request #11803 from pytest-dev/package-scope-note
Add note about package scope
2024-01-12 22:15:33 +02:00
mrbean-bremen
82fda31e99 Clarify package scope
The behavior of package scope is surprising to some
(as seen by related questions on SO), this should clarify it a bit.
2024-01-12 20:03:30 +01:00
Ran Benita
5645fa45fb Merge pull request #11801 from bluetech/node-iterchain
nodes: add `Node.iterchain()` function
2024-01-12 11:01:48 +02:00
Ran Benita
5bd5b80afd nodes: add Node.iterparents() function
This is a useful addition to the existing `listchain`. While `listchain`
returns top-to-bottom, `iterparents` is bottom-to-top and doesn't require
an internal full iteration + `reverse`.
2024-01-11 23:19:45 +02:00
Ran Benita
bd58c09500 Merge pull request #11799 from bluetech/rm-nose-compat_co_firstlineno
python: remove support for nose's `compat_co_firstlineno`
2024-01-11 13:13:30 +02:00
Faisal Fawad
996e45d66a Slight change to tmp_path documentation to more clearly illustrate its behavior (#11800) 2024-01-11 11:01:07 +00:00
Ran Benita
c7d85c5dc6 python: remove support for nose's compat_co_firstlineno
Since we're removing nose support, let's also drop support for this
attribute.

From doing a code search on github, this seems completely unused outside
of nose, except for some projects which used to use it, but no longer
do.
2024-01-10 19:22:19 +02:00
Ronny Pfannschmidt
b1c430820f Merge pull request #11794 from bluetech/fixturedef-ref-cycle
A few cleanups
2024-01-10 06:44:14 +01:00
Ran Benita
35a3863b15 config: clarify a bit of code in _importconftest 2024-01-09 23:49:03 +02:00
Ran Benita
368fa2c03e fixtures: remove unhelpful FixtureManager.{FixtureLookupError,FixtureLookupErrorRepr}
Couldn't find any reason for this indirection, nor any plugins which
rely on it. Seems like historically it was done to avoid some imports...
2024-01-09 23:33:07 +02:00
Ran Benita
372c17e228 fixtures: avoid FixtureDef <-> FixtureManager reference cycle
There is no need to store the FixtureManager on each FixtureDef.
2024-01-09 23:29:58 +02:00
Ran Benita
c4a356eaee Merge pull request #11718 from pytest-dev/dependabot/github_actions/hynek/build-and-inspect-python-package-2.0.0
build(deps): Bump hynek/build-and-inspect-python-package from 1.5.4 to 2.0.0
2024-01-09 21:44:43 +02:00
dependabot[bot]
2270cab1c2 build(deps): Bump actions/download-artifact from 3 to 4
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-09 21:12:42 +02:00
dependabot[bot]
956d0e5e9d build(deps): Bump hynek/build-and-inspect-python-package
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 1.5.4 to 2.0.0.
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v1.5.4...v2.0.0)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-09 21:12:27 +02:00
pre-commit-ci[bot]
7bc8385924 [pre-commit.ci] pre-commit autoupdate (#11792)
updates:
- [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-08 21:19:35 +00:00
Ran Benita
9b7e10a3c0 Merge pull request #11788 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-asyncio-0.23.3
build(deps): Bump pytest-asyncio from 0.23.2 to 0.23.3 in /testing/plugins_integration
2024-01-08 22:40:47 +02:00
dependabot[bot]
913d93debb build(deps): Bump pytest-asyncio in /testing/plugins_integration
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.2 to 0.23.3.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.2...v0.23.3)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-08 20:24:22 +00:00
Ran Benita
97dfc3429e Merge pull request #11785 from bluetech/matchfactories-nodes
fixtures: match fixtures based on actual node hierarchy, not textual nodeids
2024-01-08 22:23:08 +02:00
Ran Benita
992d0f082f fixtures: match fixtures based on actual node hierarchy, not textual nodeids
Refs #11662.

--- Problem

Each fixture definition has a "visibility", the `FixtureDef.baseid`
attribute. This is nodeid-like string. When a certain `node` requests a
certain fixture name, we match node's nodeid against the fixture
definitions with this name.

The matching currently happens on the *textual* representation of the
nodeid - we split `node.nodeid` to its "parent nodeids" and then check
if the fixture's `baseid` is in there.

While this has worked so far, we really should try to avoid textual
manipulation of nodeids as much as possible. It has also caused problem
in an odd case of a `Package` in the root directory: the `Package` gets
nodeid `.`, while a `Module` in it gets nodeid `test_module.py`. And
textually, `.` is not a parent of `test_module.py`.

--- Solution

Avoid this entirely by just checking the node hierarchy itself. This is
made possible by the fact that we now have proper `Directory` nodes
(`Dir` or `Package`) for the entire hierarchy.

Also do the same for `_getautousenames` which is a similar deal.

The `iterparentnodeids` function is no longer used and is removed.
2024-01-08 21:36:51 +02:00
Ran Benita
b968f63ca5 Merge pull request #11780 from bluetech/register-fixture
Add an internal "register fixture" API and use it replace object patching for fixture injection
2024-01-08 21:24:54 +02:00
Ran Benita
c8792bd080 python,unittest: replace obj fixture patching with FixtureManager._register_fixture
Instead of modifying user objects like modules and classes that we
really shouldn't be touching, use the new `_register_fixture` internal
API to do it directly.
2024-01-08 21:02:59 +02:00
Ran Benita
3234c79ee5 fixtures: add an internal API for registering a fixture
Add a function on the `FixtureManager` to register a fixture with
pytest. Currently this can only be done through `parsefactories`.

My aim is to eventually make something like this available to plugins,
as it's a pretty common need.
2024-01-08 21:02:59 +02:00
Ran Benita
851b72f289 Merge pull request #11776 from bluetech/unittest-xunit-inline
unittest: inline `_make_xunit_fixture`
2024-01-08 21:02:24 +02:00
Ran Benita
1d7349d18c Merge pull request #11774 from bluetech/fspath-cleanups
Small `fspath` cleanups
2024-01-08 21:01:56 +02:00
github-actions[bot]
5747a6c06e [automated] Update plugin list (#11784)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2024-01-07 10:20:38 -03:00
Fabian Sturm
13eacdad8a Add summary for xfails with -rxX option (#11574)
Co-authored-by: Brian Okken <1568356+okken@users.noreply.github.com>
2024-01-05 09:59:19 -03:00
Ran Benita
a616adf3ae unittest: inline _make_xunit_fixture
The indirection makes things harder to follow in this case IMO.
2024-01-05 14:37:03 +02:00
Ran Benita
685e52ec30 nodes: fix attribute name fspath -> path in get_fslocation_from_item 2024-01-04 22:32:34 +02:00
Ran Benita
7b4ab8134e fixtures: remove unnecessary fspath workaround 2024-01-04 22:32:34 +02:00
Ran Benita
c2a4a8d518 Merge pull request #11769 from neutrinoceros/fix_warns_docstring
Fix a mistake in pytest.warns' docstring (expect_warning accepts tuples, not any sequence)
2024-01-04 14:27:49 +02:00
Clément Robert
ac96256272 Fix a mistake in pytest.warns' docstring (expect_warning accepts tuples, not any sequence) 2024-01-04 11:51:12 +01:00
Bruno Oliveira
d38193646d Update docstring of scripts/generate-gh-release-notes.py (#11767)
Follow up to #11754.
2024-01-04 07:29:20 -03:00
Bruno Oliveira
cd07177906 Merge pull request #11754 from nicoddemus/release-notes
Improve GitHub release workflow
2024-01-03 20:14:48 -03:00
Bruno Oliveira
6321b74fae Enable type-checking in scripts/ 2024-01-03 19:47:56 -03:00
Bruno Oliveira
5aa289e478 Improve GitHub release workflow
This changes the existing script to just generate the release notes and delegate the actual publishing to the `softprops/action-gh-release@v1` action.

This allows us to delete the custom code, which failed recently in https://github.com/pytest-dev/pytest/actions/runs/7370258570/job/20056477756.
2024-01-03 19:47:56 -03:00
Ben Brown
12b9bd5801 Fix teardown error reporting when --maxfail=1 (#11721)
Co-authored-by: Ran Benita <ran@unusedvar.com>
2024-01-03 19:39:24 +02:00
Ran Benita
f017df443a Merge pull request #11757 from bluetech/rm-removed-in-8
Remove pytest 8 deprecations
2024-01-03 16:53:10 +02:00
Ran Benita
1ba07450e4 doc/deprecations: fix incorrect title level 2024-01-03 14:29:45 +02:00
Ran Benita
215f4d1fab Remove PytestRemovedIn8Warning
Per our deprecation policy.
2024-01-03 14:29:45 +02:00
Ran Benita
6c89f9261c Remove deprecated py.path (fspath) node constructor arguments 2024-01-03 14:29:45 +02:00
Ran Benita
a98f02d423 Remove deprecated py.path hook arguments 2024-01-03 14:29:42 +02:00
Marc Bresson
effc2b0529 Clarified markers ini property. Fix #11738 (#11739) 2024-01-03 14:20:54 +02:00
Ran Benita
2c5c97b6d1 Merge pull request #11760 from bluetech/fix-highlight-empty-source
terminalwriter: fix crash trying to highlight empty source
2024-01-03 09:38:29 +02:00
Ran Benita
cb5a42c836 terminalwriter: fix crash trying to highlight empty source
For quick checking I don't know how we can reach here with an empty
source, so test just checks the function directly.

Fix #11758.
2024-01-02 19:37:24 +02:00
Ran Benita
0f18a7fe5e Remove deprecated nose support 2024-01-02 12:20:47 +02:00
Ran Benita
0591569b4b Remove deprecated pytest.{exit,fail,skip}(msg=...) argument 2024-01-02 12:20:47 +02:00
Ran Benita
477959ef7d Remove deprecated pytest.Instance backward compat 2024-01-02 12:20:47 +02:00
Ran Benita
4147c92b21 Remove deprecated pytest.warns(None) 2024-01-02 12:20:47 +02:00
Ran Benita
10fbb2325f Remove deprecated Parser.addoption backward compatibilities 2024-01-02 12:20:47 +02:00
Ran Benita
1f8b39ed32 Remove deprecated --strict option 2024-01-02 12:20:47 +02:00
Ran Benita
f4e7b0d6e0 Remove deprecated pytest_cmdline_preparse hook 2024-01-02 12:20:47 +02:00
Ran Benita
f13724e2e3 Remove deprecated {FSCollector,Package}.{gethookproxy,isinitpath} 2024-01-02 12:20:47 +02:00
Ran Benita
a53984a55b Merge pull request #11756 from pytest-dev/cherry-pick-release
Cherry pick 8.0.0rc1 release notes
2024-01-02 11:20:03 +02:00
Ran Benita
d3c7ba310c Merge pull request #11744 from pytest-dev/release-8.0.0rc1
Prepare release 8.0.0rc1

(cherry picked from commit 665e4e58d3)
2024-01-02 10:59:26 +02:00
Ran Benita
6bec880283 Merge pull request #11753 from bluetech/cherry-pick-release
Cherry-pick 7.4.4 release notes
2023-12-31 14:26:50 +02:00
Ran Benita
a1b6b7473b Merge pull request #11752 from pytest-dev/release-7.4.4
Prepare release 7.4.4

(cherry picked from commit 18dcd9d38d)
2023-12-31 14:15:46 +02:00
Ran Benita
3701d1218b Merge pull request #11746 from pytest-dev/update-plugin-list/patch-acd445a3f
[automated] Update plugin list
2023-12-31 10:26:34 +02:00
Ran Benita
d220880924 nodes: fix tracebacks from collection errors are not getting pruned (#11711)
Fix #11710.
2023-12-31 10:14:23 +02:00
Ran Benita
640f84a5aa Merge pull request #11745 from bluetech/change-marked-fixture-removal
Change "Marks applied to fixtures" removal from 8 to 9
2023-12-31 10:10:20 +02:00
pytest bot
460c38915d [automated] Update plugin list 2023-12-31 00:20:30 +00:00
Ran Benita
a71a95b54c Change "Marks applied to fixtures" removal from 8 to 9
The deprecation has only been added in 8.0, so can't be removed in 8.
That will have to wait for 9.
2023-12-30 22:14:40 +02:00
Ran Benita
acd445a3f3 Merge pull request #11646 from bluetech/pkg-collect
Rework Session and Package collection
2023-12-30 12:51:48 +02:00
Ran Benita
c7ee55993b Merge pull request #11736 from pytest-dev/update-plugin-list/patch-52db918a2
[automated] Update plugin list
2023-12-30 12:49:17 +02:00
Ran Benita
b9855b244d Merge pull request #11737 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-12-30 12:35:31 +02:00
pre-commit-ci[bot]
1e5aab1b2b [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 23.12.0 → 23.12.1](https://github.com/psf/black/compare/23.12.0...23.12.1)
- [github.com/pre-commit/mirrors-mypy: v1.7.1 → v1.8.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.7.1...v1.8.0)
2023-12-25 20:43:18 +00:00
pytest bot
f93c0fc34e [automated] Update plugin list 2023-12-24 00:20:08 +00:00
Michał Górny
52db918a27 Fix handling empty values of NO_COLOR and FORCE_COLOR (#11712)
* Fix handling empty values of NO_COLOR and FORCE_COLOR

Fix handling NO_COLOR and FORCE_COLOR environment variables to correctly
be ignored when they are set to an empty value, as defined
in the specification:

> Command-line software which adds ANSI color to its output by default
> should check for a NO_COLOR environment variable that, when present
> *and not an empty string* (regardless of its value), prevents
> the addition of ANSI color.

(emphasis mine, https://no-color.org/)

The same is true of FORCE_COLOR, https://force-color.org/.

* Streamline testing for FORCE_COLOR and NO_COLOR

Streamline the tests for FORCE_COLOR and NO_COLOR variables, and cover
all possible cases (unset, set to empty, set to "1").  Combine the two
assert functions into one taking boolean parameters.  Mock file.isatty
in all circumstances to ensure that the environment variables take
precedence over the fallback value resulting from isatty check (or that
the fallback is actually used, in the case of both FORCE_COLOR
and NO_COLOR being unset).
2023-12-23 10:12:13 +02:00
Ran Benita
54a0ee02ea Merge pull request #11732 from bluetech/typing-tweaks
Some minor typing tweaks
2023-12-22 13:00:52 +02:00
Benjamin Schubert
88ae27da08 Add syntactic highlights to the error explanations (#11661)
* Put a 'reset' color in front of the highlighting

When doing the highlighting, some lexers will not set the initial color
explicitly, which may lead to the red from the errors being propagated
to the start of the expression

* Add syntactic highlighting to the error explanations

This updates the various error reporting to highlight python code when
displayed, to increase readability and make it easier to understand
2023-12-21 17:11:56 +00:00
Ran Benita
e06a3d02f8 Merge pull request #11715 from pytest-dev/update-plugin-list/patch-047ba83da
[automated] Update plugin list
2023-12-21 17:16:29 +02:00
Ran Benita
75f292d9df Some minor typing tweaks 2023-12-19 23:29:27 +02:00
pre-commit-ci[bot]
581762fcba [pre-commit.ci] pre-commit autoupdate (#11722)
updates:
- [github.com/psf/black: 23.11.0 → 23.12.0](https://github.com/psf/black/compare/23.11.0...23.12.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-18 21:43:27 +00:00
Benjamin Schubert
803b190a17 Merge pull request #11660 from BenjaminSchubert/bschubert/simplify-pprint
Remove more unused pprint features
2023-12-18 09:04:35 +00:00
Benjamin Schubert
283a746dad pprint: Remove conversion to int, we only accept those 2023-12-18 08:35:57 +00:00
Benjamin Schubert
64b5b665cf pprint: Remove the option to add underscore for numbers
This is never used, we can remove this. If we wanted instead, we could
always enable it
2023-12-18 08:35:57 +00:00
Benjamin Schubert
6aa35f772f pprint: Remove the option to sort dictionaries, we always do it 2023-12-18 08:35:57 +00:00
Benjamin Schubert
03b24e5b30 pprint: Remove the format method, it's not used outside of pprint
Let's reduce the API surface for the bundled PrettyPrinter to what we
really need and use
2023-12-18 08:35:57 +00:00
dependabot[bot]
7541c5a999 build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#11717)
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/4.1.0...4.2.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  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>
2023-12-18 06:33:59 +01:00
pytest bot
27f7cee238 [automated] Update plugin list 2023-12-17 00:20:43 +00:00
Arthur Richard
047ba83dab Improve pytest.exit docs (#11698)
Fixes #11695
2023-12-14 08:14:36 -03:00
Tom Mortimer-Jones
2b86d2bddc Typo in fixtures.rst (#11699) 2023-12-13 13:24:43 +01:00
dependabot[bot]
dfc910ee90 build(deps): Bump django from 4.2.7 to 5.0 in /testing/plugins_integration (#11692)
* build(deps): Bump django in /testing/plugins_integration

Bumps [django](https://github.com/django/django) from 4.2.7 to 5.0.
- [Commits](https://github.com/django/django/compare/4.2.7...5.0)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump python version on the plugin job

https://github.com/pytest-dev/pytest/pull/11692#issuecomment-1849963332

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2023-12-11 14:18:43 +00:00
dependabot[bot]
ab307b3402 build(deps): Bump actions/setup-python from 4 to 5 (#11690)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-11 09:46:13 +01:00
dependabot[bot]
8ce76c307e build(deps): Bump actions/stale from 8 to 9 (#11691)
Bumps [actions/stale](https://github.com/actions/stale) from 8 to 9.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v8...v9)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-11 09:28:50 +01:00
dependabot[bot]
ef8bf82a78 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#11693)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.1 to 0.23.2.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.1...v0.23.2)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-11 09:24:52 +01:00
Ran Benita
e1c66ab0ad Different fix for conftest loading
--- Current main

In current main (before pervious commit), calls to gethookproxy/ihook
are the trigger for loading non-initial conftests. This basically means
that conftest loading is done almost as a random side-effect,
uncontrolled and very non-obvious. And it also dashes any hope of making
gethookproxy faster (gethookproxy shows up prominently in pytest
profiles).

I've wanted to improve this for a while, #11268 was the latest step
towards that.

--- PR before change

In this PR, I ran into a problem.

Previously, Session and Package did all of the directory traversals
inside of their collect, which loaded the conftests as a side effect. If
the conftest loading failed, it will occur inside of the collect() and
cause it to be reported as a failure.

Now I've changed things such that Session.collect and Package.collect no
longer recurse, but just collect their immediate descendants, and
genitems does the recursive expansion work.

The problem though is that genitems() doesn't run inside of specific
collector's collect context. So when it loads a conftest, and the
conftest loading fails, the exception isn't handled by any CollectReport
and causes an internal error instead.

The way I've fixed this problem is by loading the conftests eagerly in a
pytest_collect_directory post-wrapper, but only during genitems to make
sure the directory is actually selected.

This solution in turn caused the conftests to be collected too early;
specifically, the plugins are loaded during the parent's collect(), one
after the other as the directory entries are collected. So when the
ihook is hoisted out of the loop, new plugins are loaded inside the
loop, and due to the way the hook proxy works, they are added to the
ihook even though they're supposed to be scoped to the child collectors.
So no hoisting.

--- PR after change

Now I've come up with a better solution: since now the collection tree
actually reflects the filesystem tree, what we really want is to load
the conftest of a directory right before we run its collect(). A
conftest can affect a directory's collect() (e.g. with a
pytest_ignore_collect hookimpl), but it cannot affect how the directory
node itself is collected. So I just moved the conftest loading to be
done right before calling collect, but still inside the CollectReport
context.

This allows the hoisting, and also removes conftest loading from
gethookproxy since it's no longer necessary. And it will probably enable
further cleanups. So I'm happy with it.
2023-12-10 17:01:39 +02:00
Ran Benita
385796ba49 Rework Session and Package collection
Fix #7777.
2023-12-10 17:01:39 +02:00
Ran Benita
f411c8d6d7 main: add with_parents parameter to isinitpath
Will be used in upcoming commit.
2023-12-10 16:32:54 +02:00
Ran Benita
c7fcb3f281 Merge pull request #11689 from pytest-dev/update-plugin-list/patch-d1675646f
[automated] Update plugin list
2023-12-10 09:59:06 +02:00
Ran Benita
c1339628d6 Merge pull request #11684 from bluetech/docs-nitpicky
docs: enable Sphinx nitpicky mode
2023-12-10 09:42:30 +02:00
Ran Benita
397769c45e Merge pull request #11677 from bluetech/nodes-abc
nodes,python: mark abstract node classes as ABCs
2023-12-10 09:41:46 +02:00
pytest bot
5381cd083f [automated] Update plugin list 2023-12-10 00:20:38 +00:00
Ran Benita
0ae02e2165 nodes,python: mark abstract node classes as ABCs
Fixes #11676
2023-12-07 16:41:07 +02:00
Ran Benita
2aa8743bbe doc: enable Sphinx nitpicky mode
See:
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-nitpicky

This ensures we have no more broken references.
2023-12-07 12:14:45 +02:00
Ran Benita
ee91d095f6 doc: fix more broken Sphinx references 2023-12-07 11:50:02 +02:00
Ran Benita
f76af423b0 doc/reference: document FixtureLookupError 2023-12-07 11:50:02 +02:00
Ran Benita
4918883336 python_api: remove unused function _non_numeric_type_error 2023-12-07 11:03:52 +02:00
Ran Benita
d1675646f2 Merge pull request #11678 from pytest-dev/doc-nitpicks
doc: fix some broken Sphinx references
2023-12-07 09:40:52 +02:00
Sviatoslav Sydorenko
30ce631fb9 Securely pin re-actors/alls-green to v1.2 commit 2023-12-07 01:29:02 +01:00
Sviatoslav Sydorenko
b92fde37ce Introduce a gate/check GHA job
This adds a GHA job that reliably determines if all the required
dependencies have succeeded or not.

It also allows to reduce the list of required branch protection CI
statuses to just one — `check`. This reduces the maintenance burden
by a lot and have been battle-tested across a small bunch of projects
in its action form and in-house implementations of other people.

I was curious about the spread of use. And I've just discovered that
it is now in use in aiohttp (and other aio-libs projects), CherryPy,
some of the Ansible repositories, all of the jaraco's projects (like
`setuptools`, `importlib_metadata`), some PyCQA, PyCA and pytest
projects, a few AWS Labs projects. Admittedly, I maintain a few of
these but it seems to address some of the pain folks have:
https://github.com/jaraco/skeleton/pull/55#issuecomment-1106638475.

The story behind this is explained in more detail at
https://github.com/marketplace/actions/alls-green#why.
2023-12-07 01:29:02 +01:00
Ran Benita
9056db4de5 doc: fix some broken Sphinx references 2023-12-07 00:30:35 +02:00
Ran Benita
a5ee9f2ecd doc: document pytest.{hookspec,hookimpl} in the API Reference
Makes sense for them to be there; also allows for Sphinx refs.
2023-12-07 00:11:42 +02:00
Benjamin Schubert
a536f49d91 Separate the various parts of the error report with newlines (#11659)
Previously the error report would have all sections glued together:

- The assertion representation
- The error explanation
- The full diff

This makes it hard to see at a glance where which one starts and ends.

One of the representation (dataclasses, tuples, attrs) does display a
newlines at the start already.

Let's add a newlines before the error explanation and before the full
diff, so we get an easier to read report.

This has one disadvantage: we get one line less in the least verbose
mode, where the output gets truncated.
2023-12-06 09:25:00 +00:00
Ran Benita
cd269f0e6d Merge pull request #11668 from bluetech/rm-setup-py
Remove `setup.py`
2023-12-05 17:29:43 +02:00
Ran Benita
b8118ab70d Remove setup.py
Fix #11667.
2023-12-04 22:45:59 +02:00
dependabot[bot]
022f1b4de5 build(deps): Bump pytest-bdd in /testing/plugins_integration (#11665)
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/7.0.0...7.0.1)

---
updated-dependencies:
- dependency-name: pytest-bdd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-12-04 13:58:18 +00:00
dependabot[bot]
db8c6f1da8 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#11664)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.21.1 to 0.23.1.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.21.1...v0.23.1)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  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>
2023-12-04 10:41:34 -03:00
dependabot[bot]
3e14c4b3c4 build(deps): Bump pypa/gh-action-pypi-publish from 1.8.10 to 1.8.11 (#11663)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.10 to 1.8.11.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.10...v1.8.11)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-04 10:41:20 -03:00
github-actions[bot]
714ce2e872 [automated] Update plugin list (#11658)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-12-03 11:49:36 -03:00
touilleWoman
5689d806cf Fix "Customizing Colors" documentation section (#11652)
Fixes #11573
2023-12-01 11:25:01 -03:00
Ran Benita
0f6c17ca83 Merge pull request #11654 from pytest-dev/testing-unnecessary-skip
testing: remove a no longer necessary skip
2023-12-01 00:28:23 +02:00
Ran Benita
ef699f8c17 testing: remove a no longer necessary skip
pytest-xdist was released at 2019-02-15, seems enough time.
2023-11-30 19:53:31 +02:00
Ran Benita
81c06b3955 Merge pull request #11650 from bluetech/tr-test-isolation
testing: fix isolation issue in `tr` fixture
2023-11-28 20:14:20 +02:00
Ran Benita
968510b6aa testing: fix isolation issue in tr fixture
The default for `_prepareconfig` is to use `sys.argv`, which in this
case are the flags passed to (top-level) `pytest`. This is not the
intention, the tests themselves should not be affected by it.
2023-11-28 19:54:24 +02:00
Ran Benita
5782aab017 Merge pull request #11648 from bluetech/fix-locale-encoding
pytester: avoid EncodingWarning from `locale.getpreferredencoding`
2023-11-28 18:12:28 +02:00
Ran Benita
ad1bccdead pytester: avoid EncodingWarning from locale.getpreferredencoding
When running `tox -e py-lsof` I get a deluge of this warning:

```
src/pytest/.tox/py-lsof-numpy-pexpect/lib/python3.11/site-packages/_pytest/pytester.py:130: EncodingWarning: UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.
```

Use `locale.getencoding` instead.
2023-11-28 17:40:58 +02:00
Benjamin Schubert
172bf89ad1 Merge pull request #11644 from BenjaminSchubert/bschubert/pprint-cleanup
Various cleanups of the vendored pprint module
2023-11-27 22:54:46 +00:00
Benjamin Schubert
88c3546006 pprint: use a set instead of a dict for the context
This is really what the context is doing, we don't need to use a dict
for it
2023-11-27 22:40:09 +00:00
Benjamin Schubert
50607297f4 pprint: Remove tracking of whether an object is readable
This information is not used anywhere
2023-11-27 22:40:09 +00:00
Benjamin Schubert
767f08cecd pprint: Remove tracking of whether the object is recursive
This information is not used anywhere, we can simplify by just not
tracking it
2023-11-27 22:40:09 +00:00
Benjamin Schubert
e5a448cd5f pprint: Type annotate the module
This will make it easier to refactor
2023-11-27 22:40:09 +00:00
Benjamin Schubert
64e72b79f6 pprint: Remove unused arguments on PrettyPrinter 2023-11-27 22:40:09 +00:00
pre-commit-ci[bot]
c4375f14b8 [pre-commit.ci] pre-commit autoupdate (#11645)
updates:
- [github.com/pre-commit/mirrors-mypy: v1.7.0 → v1.7.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.7.0...v1.7.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-27 20:55:06 +00:00
Benjamin Schubert
2d1710e0e9 Improve the full diff by having more consistent indentation in the PrettyPrinter (#11571)
The normal default pretty printer is not great when objects are nested
and it can get hard to read the diff.

Instead, provide a pretty printer that behaves more like when json get
indented, which allows for smaller, more meaningful differences, at
the expense of a slightly longer diff.

This does not touch the other places where the pretty printer is used,
and only updated the full diff one.
2023-11-27 16:47:18 +02:00
Ran Benita
fe8cda051b Merge pull request #11642 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--4.1.0
build(deps): Bump anyio[curio,trio] from 4.0.0 to 4.1.0 in /testing/plugins_integration
2023-11-27 10:22:45 +02:00
Ran Benita
df963fded7 Merge pull request #11641 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-rerunfailures-13.0
build(deps): Bump pytest-rerunfailures from 12.0 to 13.0 in /testing/plugins_integration
2023-11-27 10:20:09 +02:00
dependabot[bot]
6053bb8d6a build(deps): Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 4.0.0 to 4.1.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/4.0.0...4.1.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 03:05:25 +00:00
dependabot[bot]
03220f7c9e build(deps): Bump pytest-rerunfailures in /testing/plugins_integration
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 12.0 to 13.0.
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/12.0...13.0)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 03:05:20 +00:00
Michał Górny
85e0f676c5 Reset color-related envvars for testing (#11638)
Reset color-related environment variables in a fixture to prevent them
from affecting test results.  Otherwise, some of the tests fail
e.g. if NO_COLOR is set in the calling environment.
2023-11-26 11:09:18 -03:00
github-actions[bot]
e0d5754d5d [automated] Update plugin list (#11640)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-11-26 11:09:03 -03:00
Jens Tröger
acab13fcc9 Add new filtering() method to LogCaptureFixture class (#11625)
Fixes #11610
2023-11-24 09:38:34 -03:00
Simon Blanchard
a42530a09d Fix for operation on closed file in faulthandler teardown (#11584) 2023-11-22 22:05:00 +02:00
Ran Benita
fdb8bbf154 Merge pull request #11626 from BenjaminSchubert/bschubert/vendored-pprint
Vendor in and absorb the pprint module from upstream
2023-11-20 18:13:34 +02:00
Benjamin Schubert
53d7b5ed3e Add some tests for the pprint module 2023-11-20 13:00:08 +00:00
Benjamin Schubert
19934b2b0c Merge the AlwaysDispathPrettyPrinter into the now vendored PrettyPrinter
We don't need to keep the separation anymore, and this will make it
easier to extend
2023-11-20 13:00:00 +00:00
Benjamin Schubert
2953120003 Fix typing information for the pprint module
There is more type information that could be added. We can add those
later to make it easier, this is jsut the minimum to allow linting to
pass
2023-11-20 13:00:00 +00:00
Benjamin Schubert
5fae5ef73e Apply project-wide formatting standard to the pprint module (black) 2023-11-20 13:00:00 +00:00
Benjamin Schubert
66f2f20eff Run pyupgrade on the pprint module 2023-11-20 13:00:00 +00:00
Benjamin Schubert
2322668344 Remove unneeded pprint interfaces
There are parts of the original pprint module that we won't need, let's
limit the surface and remove the unnecessary code
2023-11-20 13:00:00 +00:00
Benjamin Schubert
eb6ad08e5d Vendor in the pprint module to allow further modifications
We already have the AlwaysDispatchingPrettyPrinter override of the
default pretty printer. In order to make more in depth changes, we
need to copy the upstream version in, as it doesn't lend itself well to
being extended.

This does a verbatime copy, adding provenance information at the top.
2023-11-20 13:00:00 +00:00
Anthony Sottile
0916191827 use name-independent github actions badge (#11628)
if we were ever to change the `name:` field in `test.yml` this would suddenly break -- this references the workflow file directly (and is what github generates now for badges)
2023-11-19 13:19:30 -03:00
github-actions[bot]
476bab84f7 [automated] Update plugin list (#11627)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-11-19 11:57:25 -03:00
Patrick Lannigan
9dc1fc4523 Add verbosity_assertions and config.get_verbosity
Fixes #11387
2023-11-19 11:56:29 -03:00
Avasam
80442ae2f2 Use False, instead of None as default for _XfailMarkDecorator's condition param and update doc (#11600) 2023-11-17 10:42:05 +02:00
Miro Hrončok
223e030604 XFAIL TestLocalPath.test_make_numbered_dir_multiprocess_safe (#11611)
The tested py.path.local.make_numbered_dir function is *not*
multiprocess safe, because is uses os.listdir which itself is not.

The os.listdir documentation explicitly states that:

> If a file is removed from or added to the directory during the call
> of this function, whether a name for that file be included is unspecified.

This can lead to a race when:

 1. process A attempts to create directory N
 2. the creation fails, as another process already created it in the meantime
 3. process A calls listdir to determine a more recent maxnum
 4. processes B+ repeatedly create newer directories and they delete directory N
 5. process A doesn't have directory N or any newer directory in listdir result
 6. process A attempts to create directory N again and raises

For details, see https://github.com/pytest-dev/pytest/issues/11603#issuecomment-1805708144
and bellow.

Additionally, the test itself has a race in batch_make_numbered_dirs.
When this functions attempts to write to repro-N/foo,
repro-N may have already been removed by another process.

For details, see https://github.com/pytest-dev/pytest/issues/11603#issuecomment-1804714313
and bellow.

---

The tested py.path.local.make_numbered_dir function is not used in pytest.
There is a different implementation in _pytest.pathlib.

Closes #11603
2023-11-14 11:41:35 -03:00
Bruno Oliveira
1eca302c4d Merge pull request #11613 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-11-14 07:50:59 -03:00
Bruno Oliveira
970d11cf34 Explicitly export error and path from py
Required by mypy 1.7.0
2023-11-14 07:29:40 -03:00
pre-commit-ci[bot]
d4c56c72d8 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 23.10.1 → 23.11.0](https://github.com/psf/black/compare/23.10.1...23.11.0)
- [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.7.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.1...v1.7.0)
2023-11-13 21:00:52 +00:00
dependabot[bot]
442b09ed9f build(deps): Bump pytest-django in /testing/plugins_integration (#11609)
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.6.0 to 4.7.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.6.0...v4.7.0)

---
updated-dependencies:
- dependency-name: pytest-django
  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>
2023-11-13 09:29:21 +01:00
dependabot[bot]
9417aeb2d8 build(deps): Bump pytest-html in /testing/plugins_integration (#11608)
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: pytest-html
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-13 09:28:54 +01:00
github-actions[bot]
99f7738810 [automated] Update plugin list (#11607)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-11-12 10:41:08 -03:00
Sharad Nair
7c7bdf4574 Sanitize ini-options default handling #11282 (#11594)
Fixes #11282
2023-11-11 13:08:18 -03:00
Ran Benita
6fe43912be Merge pull request #11591 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-23.10.0
build(deps): Bump twisted from 23.8.0 to 23.10.0 in /testing/plugins_integration
2023-11-08 09:29:18 +02:00
github-actions[bot]
e701df5eb6 [automated] Update plugin list (#11587)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-11-06 18:40:44 -03:00
dependabot[bot]
92cd7950e6 build(deps): Bump pytest-django in /testing/plugins_integration (#11592)
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.5.2 to 4.6.0.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.5.2...v4.6.0)

---
updated-dependencies:
- dependency-name: pytest-django
  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>
2023-11-06 09:26:10 +01:00
dependabot[bot]
ef2216c21b build(deps): Bump hynek/build-and-inspect-python-package (#11589)
Bumps [hynek/build-and-inspect-python-package](https://github.com/hynek/build-and-inspect-python-package) from 1.5.3 to 1.5.4.
- [Release notes](https://github.com/hynek/build-and-inspect-python-package/releases)
- [Changelog](https://github.com/hynek/build-and-inspect-python-package/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hynek/build-and-inspect-python-package/compare/v1.5.3...v1.5.4)

---
updated-dependencies:
- dependency-name: hynek/build-and-inspect-python-package
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 07:50:49 +01:00
dependabot[bot]
01a248d2a9 build(deps): Bump pytest-html in /testing/plugins_integration (#11590)
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 4.0.2 to 4.1.0.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/4.0.2...4.1.0)

---
updated-dependencies:
- dependency-name: pytest-html
  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>
2023-11-06 07:49:53 +01:00
dependabot[bot]
1a7641cf88 build(deps): Bump twisted in /testing/plugins_integration
Bumps [twisted](https://github.com/twisted/twisted) from 23.8.0 to 23.10.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-23.8.0...twisted-23.10.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-06 03:58:57 +00:00
Bruno Oliveira
70f03dbc3e Adjustments to assert raises docs (#11586)
Followup from #11578.
2023-11-04 12:37:47 -03:00
Bruno Oliveira
1e02797d15 Improve pytest.raises docs (#11578) 2023-11-04 10:24:57 +00:00
neilmartin2000
13e5ef0102 Created link to PEP-8 in documentation (#11582) 2023-11-03 15:05:05 -03:00
dependabot[bot]
1ea10c20df build(deps): Bump django in /testing/plugins_integration (#11579)
Bumps [django](https://github.com/django/django) from 4.2.6 to 4.2.7.
- [Commits](https://github.com/django/django/compare/4.2.6...4.2.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-03 08:27:47 -03:00
Ran Benita
8fb7e8b31e Merge pull request #11567 from bluetech/fix-ref-tocdepth
doc/reference: fix sidebar TOC depth
2023-10-30 09:01:54 +02:00
Ran Benita
0d74a1c8a0 doc: allow Sphinx 6.x and 7.x (#11568)
They seem to work fine, let's allow them.
2023-10-29 23:00:27 +01:00
Ran Benita
730c7ca0b1 Merge pull request #11566 from pytest-dev/update-plugin-list/patch-738ae2da9
[automated] Update plugin list
2023-10-29 22:48:26 +02:00
Ran Benita
4ecf313604 doc/reference: fix sidebar TOC depth
Previously, the sidebar TOC had unlimited depth, making it useless and
interfering with the content. This seems to have regressed in pytest
7.2.x going by the RTD version selector.
2023-10-29 21:55:17 +02:00
pytest bot
d0a09d8627 [automated] Update plugin list 2023-10-29 00:19:06 +00:00
Zac Hatfield-Dodds
738ae2da9d Merge pull request #11564 from nicoddemus/empty-string-parametrize-11563
Fix crash using empty string for parametrized value more than once
2023-10-27 16:51:31 -04:00
Bruno Oliveira
7156a97f9a Fix crash using empty string for parametrized value more than once
Fixes #11563.
2023-10-27 17:26:12 -03:00
Ziad Kermadi
ed8701a57f Mention -q and -s in the docs (#11558)
Fixes #11507.
2023-10-27 14:35:45 -03:00
Bruno Oliveira
247436819a Update build-and-inspect-python-package action (#11561)
This should fix the action for Python 3.12.

Ref: hynek/build-and-inspect-python-package#72
2023-10-27 08:32:02 -03:00
Bruno Oliveira
c1728948ac Fix tag name generated by deploy workflow (#11550)
Traditionally pytest publishes tags in the form `X.Y.Z`, however the deploy workflow (copied from somewhere else) published tags in the form `vX.Y.Z`.

This is the root cause of #11548, because it tried to publish the release notes for tag `X.Y.Z` (which did not exist).

Fix #11548
2023-10-25 13:19:47 -03:00
Bruno Oliveira
dcd8b145d9 Add deploy instructions using the command-line (#11547)
Tested this to trigger the deploy of #11546.
2023-10-25 10:04:06 -03:00
Bruno Oliveira
c7e9b22f37 Merge pull request #11546 from pytest-dev/release-7.4.3 (#11549)
Prepare release 7.4.3

(cherry picked from commit 53df6164b4)
2023-10-24 16:50:13 -03:00
Benjamin Schubert
fbe3e29a55 Color the full diff that pytest shows as a diff (#11530)
Related to #11520
2023-10-24 08:42:21 -03:00
pre-commit-ci[bot]
667b9fd7fd [pre-commit.ci] pre-commit autoupdate (#11543)
updates:
- [github.com/psf/black: 23.9.1 → 23.10.1](https://github.com/psf/black/compare/23.9.1...23.10.1)
- [github.com/pre-commit/mirrors-mypy: v1.6.0 → v1.6.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.0...v1.6.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-24 03:42:43 +02:00
Carsten Grohmann
38f7c1e346 Use pytestconfig instead of request.config in cache example (#11542)
to be consistent with the API documentation.
2023-10-23 15:45:16 -03:00
Bruno Oliveira
bcd9664370 Merge pull request #11531 from nicoddemus/ensure-logging-cleanup
Ensure logging tests always cleanup after themselves
2023-10-23 10:55:18 -03:00
Bruno Oliveira
7e69ce7449 Add full type annotations to logging/test_fixture.py 2023-10-23 10:46:55 -03:00
Bruno Oliveira
395bbae8a2 Ensure logging tests always cleanup after themselves
Logging has many global states, and we did foresee this by creating a ``cleanup_disabled_logging`` fixture,
however one might still forget to use it and failures leak later -- sometimes not even in the same PR, because the order
of the tests might change in the future, specially when running under xdist.

This problem surfaced during pytest-dev/pytest#11530, where tests unrelated to the change started to fail.
2023-10-23 10:46:55 -03:00
Bruno Oliveira
ee53433542 Configure ReadTheDocs to fail on warnings (#11535)
* Configure ReadTheDocs to fail on warnings

Important to catch broken links and references.

* Remove dead link to distutils configuration docs
2023-10-23 09:56:33 -03:00
dependabot[bot]
304ab8495e build(deps): Bump pytest-mock in /testing/plugins_integration (#11539)
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.11.1 to 3.12.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.11.1...v3.12.0)

---
updated-dependencies:
- dependency-name: pytest-mock
  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>
2023-10-23 09:01:08 -03:00
pre-commit-ci[bot]
40e9abd66b [pre-commit.ci] pre-commit autoupdate (#11510)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.6.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.1...v1.6.0)

* Ignore two typing errors after updating to mypy 1.6.0

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2023-10-23 08:05:40 -03:00
github-actions[bot]
cac1eed0ea [automated] Update plugin list (#11534)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-10-21 23:43:14 -03:00
dependabot[bot]
cdddd6d695 build(deps): Bump pytest-bdd in /testing/plugins_integration (#11506)
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 6.1.1 to 7.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/6.1.1...7.0.0)

---
updated-dependencies:
- dependency-name: pytest-bdd
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-16 08:08:50 -03:00
github-actions[bot]
dd68f9c95a [automated] Update plugin list (#11504)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-10-15 10:03:38 -03:00
ryanpudd
3ab70cd561 Use hyphenated cmdline options in docs (#11490)
Fix #11091
2023-10-10 21:16:24 +00:00
dependabot[bot]
23825f2983 build(deps): Bump django in /testing/plugins_integration (#11491)
Bumps [django](https://github.com/django/django) from 4.2.5 to 4.2.6.
- [Commits](https://github.com/django/django/compare/4.2.5...4.2.6)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-10 17:50:54 -03:00
pre-commit-ci[bot]
fb3a46dd8a [pre-commit.ci] pre-commit autoupdate (#11492)
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0)
- [github.com/asottile/pyupgrade: v3.14.0 → v3.15.0](https://github.com/asottile/pyupgrade/compare/v3.14.0...v3.15.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-10 06:33:25 +02:00
Zac Hatfield-Dodds
3d6d93d0c2 Merge pull request #11486 from pytest-dev/RonnyPfannschmidt-contributing-tags 2023-10-09 11:29:49 -07:00
github-actions[bot]
2401d76655 [automated] Update plugin list (#11487)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-10-09 08:32:49 -03:00
Tanya Agarwal
af9b1dcc24 Duplicated parameters in parametrize marker (#11489)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
2023-10-08 10:26:31 -07:00
Ronny Pfannschmidt
696859fc43 Update CONTRIBUTING.rst
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-10-07 16:16:18 +02:00
Ronny Pfannschmidt
e966dcd93c Update CONTRIBUTING.rst to mention tag fetches
closes #11485
2023-10-07 15:54:45 +02:00
pre-commit-ci[bot]
54623f0f33 [pre-commit.ci] pre-commit autoupdate (#11478)
updates:
- [github.com/asottile/reorder-python-imports: v3.11.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.11.0...v3.12.0)
- [github.com/asottile/pyupgrade: v3.13.0 → v3.14.0](https://github.com/asottile/pyupgrade/compare/v3.13.0...v3.14.0)
- [github.com/asottile/setup-cfg-fmt: v2.4.0 → v2.5.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.4.0...v2.5.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-10-03 11:47:19 +00:00
Reagan Lee
9bbfe995ee Add more comprehensive set assertion rewrites (#11469)
Fixes #10617
2023-10-02 18:37:52 -03:00
github-actions[bot]
d015bc1b8f [automated] Update plugin list (#11472)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-10-02 08:39:53 -03:00
pre-commit-ci[bot]
b73b4c464c [pre-commit.ci] pre-commit autoupdate (#11468)
updates:
- [github.com/asottile/pyupgrade: v3.11.0 → v3.13.0](https://github.com/asottile/pyupgrade/compare/v3.11.0...v3.13.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-26 09:31:39 +00:00
Ran Benita
1a16bac131 Merge pull request #11315 from bluetech/pytest-monkeypatch-chdir
pytester: use `monkeypatch.chdir()` for dir changing
2023-09-25 12:10:14 +03:00
Ran Benita
81192ca85f pytester: use monkeypatch.chdir() for dir changing
The current method as the following problem, described by Sadra
Barikbin:

The tests that request both `pytester` and `monkeypatch` and use
`monkeypatch.chdir` without context, relying on `monkeypatch`'s teardown
to restore cwd. This doesn't work because the following sequence of
actions take place:

- `monkeypatch` is set up.
- `pytester` is set up. It saves the original cwd and changes it to a
  new one dedicated to the test function.
- Test function calls `monkeypatch.chdir()` without context.
  `monkeypatch` saves cwd, which is not the original one, before
  changing it.
- `pytester` is torn down. It restores the cwd to the original one.
- `monkeypatch` is torn down. It restores cwd to what it has saved.

The solution here is to have pytester use `monkeypatch.chdir()` itself,
then everything is handled correctly.
2023-09-25 11:31:09 +03:00
Ran Benita
486a9ed057 Merge pull request #11464 from pytest-dev/update-plugin-list/patch-d2b214220
[automated] Update plugin list
2023-09-24 16:03:45 +03:00
Ran Benita
4ae102c003 Merge pull request #11446 from bluetech/pluggy-typing
Improve pluggy-related typing
2023-09-24 15:42:58 +03:00
pytest bot
c614590ec9 [automated] Update plugin list 2023-09-24 00:18:30 +00:00
Warren Markham
d2b214220f Add class docstring to NodeMeta (#11427) 2023-09-20 09:08:07 -03:00
Simon Blanchard
a38ad254ef Handle ValueError raised during faulthandler teardown code (#11453)
Fixes #11439
2023-09-20 09:06:43 -03:00
pre-commit-ci[bot]
9f22d3281c [pre-commit.ci] pre-commit autoupdate (#11451)
updates:
- [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0)
- [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-19 11:51:41 +02:00
Sharad Nair
9a58e6283d Fixes issue #11314 - log_file_format does not default to log_format (#11444)
* Fixes issue #11314 -

* Incorporated review comments for issue #11314

* Update changelog/11314.improvement.rst

Co-authored-by: Bruno Oliveira <bruno@soliv.dev>

---------

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
2023-09-18 16:50:04 +00:00
github-actions[bot]
8bac8d7807 [automated] Update plugin list (#11443)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-09-18 13:20:47 -03:00
dependabot[bot]
5e081162df build(deps): Bump pytest-html in /testing/plugins_integration (#11449)
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/4.0.1...4.0.2)

---
updated-dependencies:
- dependency-name: pytest-html
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-18 11:10:48 -03:00
Chris Mahoney
8062743f6b Change deprecated_call to handle FutureWarning (#11448)
Fixes #11447
2023-09-18 09:34:05 -03:00
Zac Hatfield-Dodds
8b7f94f145 Merge pull request #11424 from lanzz/exceptioninfo-groupcontains 2023-09-17 16:51:57 -07:00
Mihail Milushev
5ace48ca5b Fix a minor mistake in docs ("`match method" is actually talking about the match` keyword parameter) 2023-09-17 22:28:32 +01:00
Mihail Milushev
e7caaa0b3e Document the new ExceptionInfo.group_contains() method 2023-09-17 22:28:32 +01:00
Mihail Milushev
a47fcb4873 code review: kwarg-only match, replace recursive with depth 2023-09-17 22:28:32 +01:00
Mihail Milushev
ab8f5ce7f4 Add new ExceptionInfo.group_contains assertion helper method
Tests if a captured exception group contains an expected exception.
Will raise `AssertionError` if the wrapped exception is not an exception group.
Supports recursive search into nested exception groups.
2023-09-17 22:28:32 +01:00
Ran Benita
f43a8db618 Improve pluggy-related typing 2023-09-17 21:32:55 +03:00
pomponchik
6c2feb75d2 Add flask_fixture to the manual plugin list
Fixes #11435
2023-09-12 19:17:20 -03:00
pre-commit-ci[bot]
fcb8e73288 [pre-commit.ci] pre-commit autoupdate (#11434)
updates:
- [github.com/psf/black: 23.7.0 → 23.9.1](https://github.com/psf/black/compare/23.7.0...23.9.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-12 08:37:19 -03:00
Bruno Oliveira
241f2a890e Force terminal width when running tests (#11425)
Related to #11423
2023-09-11 09:22:56 -03:00
dependabot[bot]
39f9306357 build(deps): Bump pytest-html in /testing/plugins_integration (#11431)
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/4.0.0...4.0.1)

---
updated-dependencies:
- dependency-name: pytest-html
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 06:50:46 -03:00
dependabot[bot]
e0d04bdfab build(deps): Bump django in /testing/plugins_integration (#11430)
Bumps [django](https://github.com/django/django) from 4.2.4 to 4.2.5.
- [Commits](https://github.com/django/django/compare/4.2.4...4.2.5)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 06:50:32 -03:00
dependabot[bot]
1949b09fd3 build(deps): Bump actions/checkout from 3 to 4 (#11429)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 06:50:08 -03:00
Ran Benita
3d1c52f203 Merge pull request #11428 from ShurikMen/fix_tests_signature
Fix invalid signature in TestSorting tests
2023-09-11 10:30:45 +03:00
Aleksandr Brodin
a60c23c3d8 fix invalid signature 2023-09-11 09:59:00 +07:00
github-actions[bot]
24a6ee1ffd [automated] Update plugin list (#11422)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-09-10 13:09:41 +00:00
Bruno Oliveira
e2acc1a99b Fix --import-mode=importlib when root contains __init__.py file (#11420)
We cannot have an empty module name when importing a `__init__.py` file that
is at the rootdir.

Fixes #11417
2023-09-10 09:57:40 -03:00
Warren Markham
71f265f1f3 Refactor: use division operator to join paths (#11413)
Starting with `resolve_package_path` and its associated tests,
this refactoring seeks to make path concatenation more
readable and consistent within tests/functions.

As discussed in #11413:

- code is free to use either `/` and `joinpath`
- consistency within a function is more important than consistency across the codebase
- it is nice to use `/` when it is more readable
- it is nice to use `joinpath` when there is little context
- be mindful that `joinpath` may be clearer when joining multiple segments
2023-09-09 09:16:22 -03:00
Marc Mueller
7259e8db98 Fix assert rewriting with assignment expressions (#11414)
Fixes #11239
2023-09-09 09:09:31 -03:00
Ronny Pfannschmidt
dd7beb39d6 Merge pull request #11416 from bluetech/fixtures-getfixtureclosure
fixtures: more tweaks
2023-09-08 19:48:34 +02:00
Ran Benita
6ad9499c9c doctest: some missing type annotations 2023-09-08 15:59:17 +03:00
Ran Benita
2ed2e9208d doctest: remove unnecessary Optionals 2023-09-08 15:59:17 +03:00
Ran Benita
ab63ebb3dc doctest: inline _setup_fixtures, make more similar to Function
There used to be two callers to `_setup_fixtures()`, now there's only
one, so inline it and make `DoctestItem` more similar to `Function`.

(Eventually we may want to generalize `TopRequest` from taking
`Function` directly to some "fixture-supporting item", removing the
remaining `type: ignore` here and allowing plugins to do it in a stable
manner).
2023-09-08 15:59:17 +03:00
Ran Benita
b3a981d385 fixtures: remove getfixtureinfo(funcargs) in favor of None func
Since we already broke plugins using this (private) interface in this
version (pytest-play, pytest-wdl), might as well do a cleanup.
2023-09-08 15:59:17 +03:00
Sadra Barikbin
48b0395648 fixtures: clean up getfixtureclosure()
Some code cleanups - no functional changes.
2023-09-08 15:53:49 +03:00
Ran Benita
9c11275553 fixtures: change getfixtureclosure(ignore_args) to a set
Only used for containment checks so a Set is more appropriate than a
list.
2023-09-08 15:53:49 +03:00
Bruno Oliveira
e5c81fa41a Adjustments to the release process (#11410)
As discussed in #11408:

* Improve documentation for the release process.
* Fix the description for the PRs created by the `prepare release pr` workflow.
* Fix pushing tag in the `deploy` workflow.
2023-09-08 07:22:16 -03:00
Bruno Oliveira
0a06db0729 Merge pull request #11408 from pytest-dev/release-7.4.2 (#11409)
Prepare release 7.4.2

(cherry picked from commit b0c4775a28)
2023-09-07 16:10:19 -03:00
Bruno Oliveira
5936a79fdb Use _pytest.pathlib.safe_exists in get_dirs_from_args (#11407)
Related to #11394
2023-09-07 15:44:47 -03:00
Bruno Oliveira
28ccf476b9 Fix crash when passing a very long cmdline argument (#11404)
Fixes #11394
2023-09-07 12:49:25 -03:00
Fraser Stark
333e4eba6b Change PytestReturnNotNoneWarning to return a normal warning (#11211)
Fixes #10465
2023-09-07 15:11:59 +00:00
Ronny Pfannschmidt
e787d2ed48 Merge pull request #11317 from tjsmart/fix-issue-11237
Fix doctest collection of `functools.cached_property` objects.
2023-09-07 14:39:02 +02:00
Florian Bruhin
f6b6478868 doc: Remove done training (#11399) 2023-09-06 15:22:27 +02:00
Stefaan Lippens
3ce63bc768 Improve plugin list disclaimer (#11397)
Closes #11391
2023-09-06 07:34:38 -03:00
Ran Benita
faa8f2ea08 Merge pull request #11393 from pytest-dev/fixtures-tweaks
Fixtures tweaks
2023-09-06 09:15:28 +03:00
Bruno Oliveira
194a782e38 Fix import_path for packages (#11390)
For packages, `import_path` receives the path to the package's `__init__.py` file, however module names (as they live in `sys.modules`) should not include the `__init__` part.

For example, `app/core/__init__.py` should be imported as `app.core`, not as `app.core.__init__`.

Fix #11306
2023-09-05 19:42:40 -03:00
Ran Benita
bc71561ad9 python: avoid an Any 2023-09-05 22:32:46 +03:00
Ran Benita
574e0f45d9 fixtures: avoid using the mildly expensive fixturenames property
Avoid creating a list copy + 2 sets + a linear search through the list
(in the common case).
2023-09-05 22:15:37 +03:00
Ran Benita
b8906b29a7 fixtures: require item.fixturenames to exist in _fillfixtures
I could find 2 plugins that would be broken by this (pytest-play and
pytest-wdl), but they will be better served by just copying
`_fillfixtures` instead of use the private function.
2023-09-05 22:15:37 +03:00
Ran Benita
d2b5177dd6 fixtures: avoid some redundant work in _fillfixtures 2023-09-05 22:15:37 +03:00
Ran Benita
65c01f531b fixtures: use the item fixturenames in request.fixturenames
`_pyfuncitem.fixturenames` is just an alias for
`_pyfuncitem._fixtureinfo.names_closure` (at least in core pytest), so
let's do the less abstraction-breaking thing.
2023-09-05 22:15:37 +03:00
Ran Benita
82bd63d318 doctest: add fixturenames field to DoctestItem
The field is used in `_fillfixtures`, in preference to
`request.fixturenames`, which also includes already-computed which is
not needed.
2023-09-05 22:15:37 +03:00
Ran Benita
d4872f5df7 fixtures: tiny code cleanup 2023-09-05 22:15:37 +03:00
Ran Benita
8d815ca55b python: type some CallSpec2 fields as immutable
Knowing that a field is immutable makes it easier to understand the
code.
2023-09-05 22:15:37 +03:00
pre-commit-ci[bot]
8032d21271 [pre-commit.ci] pre-commit autoupdate (#11389)
updates:
- [github.com/PyCQA/autoflake: v2.2.0 → v2.2.1](https://github.com/PyCQA/autoflake/compare/v2.2.0...v2.2.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-05 10:09:33 -03:00
dependabot[bot]
9c8937b480 build(deps): Bump pytest-html in /testing/plugins_integration (#11384)
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 3.2.0 to 4.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/v3.2.0...4.0.0)

---
updated-dependencies:
- dependency-name: pytest-html
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 08:08:10 -03:00
dependabot[bot]
0d8b87f161 build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#11383)
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.7.1 to 4.0.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.7.1...4.0.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 08:08:01 -03:00
dependabot[bot]
65c73a09e7 build(deps): Bump twisted in /testing/plugins_integration (#11385)
Bumps [twisted](https://github.com/twisted/twisted) from 22.8.0 to 23.8.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-22.8.0...twisted-23.8.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 08:07:56 -03:00
Israel Fruchter
917ce9aa01 Fix user_properties not saved to XML if fixture errors during teardown
Move handling of user_properties to `finalize()`.

Previously if a fixture failed during teardown, `pytest_runtest_logreport` would not be called with "teardown", resulting in the user properties not being saved on the JUnit XML file.

Fixes: #11367
2023-09-03 14:33:54 -03:00
github-actions[bot]
4e3a0874df [automated] Update plugin list (#11380)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-09-02 22:13:17 -03:00
Bruno Oliveira
ba0da81f88 Merge pull request #11379 from nicoddemus/cherry-pick-release
Merge pull request #11377 from pytest-dev/release-7.4.1
2023-09-02 13:21:07 -03:00
Bruno Oliveira
f08782d8d0 Merge pull request #11377 from pytest-dev/release-7.4.1
Prepare release 7.4.1

(cherry picked from commit 82eb86f707)
2023-09-02 12:45:58 -03:00
dependabot[bot]
5b528bd131 build(deps): Bump pypa/gh-action-pypi-publish from 1.8.8 to 1.8.10 (#11310)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.8 to 1.8.10.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.8...v1.8.10)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-02 12:04:30 -03:00
Bruno Oliveira
e4794b26b2 Merge pull request #11378 from nicoddemus/improve-ci-workflow
Improve CI workflow
2023-09-02 11:59:25 -03:00
Bruno Oliveira
ab6cae2126 Improve CI workflow
* Build the package only once, and test on all platforms.
* Deploy is now triggered manually via an Action, which is then responsible for tagging the repository after the package has been uploaded successfully.
* Drop 'docs': we nowadays rely on readthedocs preview PR builds.
2023-09-02 10:29:02 -03:00
Sourabh Beniwal
afb8d66e42 Update CONTRIBUTING.rst (#11368)
Chnaged Status: easy to good first issue, and updated the URL
2023-08-30 11:52:14 +00:00
Sean Patrick Malloy
76ba7db6ce Improve docs for last-failed-no-failures
Improve documentation for last-failed-no-failures to make the different options and the functionality more clear.

Closes #11354
2023-08-29 00:14:45 +00:00
Ran Benita
941b203c94 Merge pull request #11360 from seanjedi/issue_11356-fixing-precommit-issue-with-flake8
fix: fixing an issue with pre-commit with mypy and flake8
2023-08-28 11:26:37 +03:00
Sean Malloy
19d6b12b2a fix: fixing an issue with pre-commit with mypy and flake8 2023-08-27 15:03:42 -07:00
github-actions[bot]
17e8f2b3fc [automated] Update plugin list (#11358)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-08-27 11:29:17 -03:00
Warren Markham
ff23347f1f Fix platform-dependent type-check errors (#11345)
Use more explicit `sys.platform` checks, instead of the previous check using `in`, which mypy understands.

Fixes #11343
2023-08-27 09:40:24 -03:00
Ran Benita
00fedcc439 Merge pull request #11353 from bluetech/pluggy-typing
Fixes for typed pluggy
2023-08-26 22:59:35 +03:00
Ran Benita
77f7f59b2a Fixes for typed pluggy
Since version 1.3 pluggy added typing, which requires some fixes to
please mypy.
2023-08-26 22:13:24 +03:00
Jon Parise
7500fe44b2 Correct the spelling of ArgSource.INVOCATION_DIR (#11333)
Config.ArgsSource.INCOVATION_DIR remains as a backwards compatibility
alias.
2023-08-23 09:21:17 +00:00
Ha Pam
23b899f31f Fix a typo in anatomy.rst (#11341) 2023-08-23 10:17:09 +02:00
Ran Benita
43d1398fc7 Merge pull request #11334 from WarrenTheRabbit/fix-docstring-spelling-in-pytester-1
doc: fix docstring spelling in pytester
2023-08-22 14:44:06 +03:00
Zac Hatfield-Dodds
03832fa31e Merge pull request #11326 from DetachHead/DetachHead-patch-1
use `if not TYPE_CHECKING` on `pytest.__getattr__` to prevent type checkers from using it
2023-08-22 03:53:46 -07:00
pre-commit-ci[bot]
8f36fd5454 [pre-commit.ci] pre-commit autoupdate (#11335)
updates:
- [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0)
- [github.com/pre-commit/mirrors-mypy: v1.5.0 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.0...v1.5.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-22 08:10:48 +00:00
DetachHead
cada6c105a ignore mypy error on deprecated Instance usage 2023-08-22 17:57:59 +10:00
WarrenTheRabbit
3f446b68fd doc: fix docstring spelling in pytester 2023-08-22 14:36:39 +10:00
Zac Hatfield-Dodds
050f402816 Merge pull request #11308 from reaganjlee/iter-reporting
Improve reporting from __iter__ exceptions
2023-08-21 16:27:42 -07:00
Reagan Lee
d1722d5c18 fix test for codecov 2023-08-21 15:49:39 -07:00
github-actions[bot]
4deb38b2ed [automated] Update plugin list (#11329)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-08-21 13:19:58 +00:00
Ran Benita
370eacd3ca doc/reference: replace Unicode dashes with ascii - in cli flags (#11323) 2023-08-21 14:40:03 +02:00
DetachHead
010e1742d8 use python 3.11 for update-plugin-list (#11328) 2023-08-21 12:29:41 +00:00
Ran Benita
6e5f10b28f Merge pull request #11320 from ubaumann/add_nuts
add nuts to plugin list
2023-08-21 14:50:31 +03:00
pre-commit-ci[bot]
dd5ae0c3b8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-08-21 08:03:06 +00:00
DetachHead
fc653d0d12 use if not TYPE_CHECKING on pytest.__getattr__ to prevent type checkers from using it 2023-08-21 18:00:28 +10:00
Tyler Smart
a357c7abc8 Ignore dip in branch coverage (since py3.13+ isn't tested in CI) 2023-08-20 20:55:30 -06:00
Reagan Lee
61133ba83d un-iterable fix 2023-08-20 14:46:09 -07:00
Reagan Lee
049eec8474 Revert iter raises checks
This reverts commit e938580257.

Revert "improve error msg and test"

This reverts commit c0cf822ca1.

Revert "error msg"

This reverts commit ec1053cc16.

Revert "changelog"

This reverts commit d2dc8a70b5.

Revert "simplify code / take out user-gen typeerror case"

This reverts commit b9cb87d862.
2023-08-20 14:06:42 -07:00
Ran Benita
37bb186175 Merge pull request #11322 from bluetech/testing-norecursedirs
testing: add `.*` to `norecursedirs`
2023-08-20 16:37:16 +03:00
Ran Benita
3cb3cd1a08 testing: add .* to norecursedirs
Setting `norecursedirs` overrides the default, so we end up scanning
dot-directories and such which slows down collection unnecessarily
(150ms on my working directory).
2023-08-20 12:16:38 +03:00
Tyler Smart
7a625481da PR suggestions 2023-08-19 22:20:40 -06:00
Ran Benita
0ddfdfcc04 Merge pull request #11321 from tjsmart/fix-doctesting
Add doctesting-coverage to envlist
2023-08-20 00:26:42 +03:00
Tyler Smart
87bfc83aa0 Add doctesting-coverage to envlist 2023-08-19 12:18:17 -06:00
Tyler Smart
ebd571bb18 Move _from_module override to pre-existsing DocTestFinder subclass 2023-08-19 12:04:59 -06:00
ubaumann
176d728b7b add nuts to plugin list
Adding https://github.com/network-unit-testing-system/nuts to the plugin list.
2023-08-18 23:34:40 +02:00
Tyler Smart
d4fb6ac9f7 Fix doctest collection of functools.cached_property objects. 2023-08-16 00:55:16 -06:00
Ran Benita
15fadd8c5c Merge pull request #11219 from bluetech/fixtures2
fixtures: make FixtureRequest abstract, add TopRequest subclass
2023-08-15 21:52:46 +03:00
pre-commit-ci[bot]
73d754bd74 [pre-commit.ci] pre-commit autoupdate (#11313)
updates:
- [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-15 07:56:42 +00:00
Ran Benita
10056865d2 Merge pull request #11309 from bluetech/docs-xfail
doc: fix a few `xfail` nits
2023-08-12 18:58:37 +03:00
Ran Benita
1827d8d5f9 doc: fix a few pytest.mark.xfail nits
Refs #9027, #10094.
2023-08-12 18:30:58 +03:00
Ran Benita
9e164fc4fe fixtures: make FixtureRequest abstract, add TopRequest subclass
Fix #11218.
2023-08-12 11:55:08 +03:00
Reagan Lee
c0cf822ca1 improve error msg and test 2023-08-11 10:33:34 -07:00
Reagan Lee
ec1053cc16 error msg 2023-08-11 10:03:19 -07:00
Reagan Lee
d2dc8a70b5 changelog 2023-08-11 09:48:53 -07:00
Reagan Lee
b9cb87d862 simplify code / take out user-gen typeerror case 2023-08-10 17:43:01 -07:00
Reagan Lee
e938580257 check for user-generated exceptions 2023-08-10 17:37:48 -07:00
Reagan Lee
47c0fc3d78 tests 2023-08-10 16:36:22 -07:00
Ran Benita
556e075d23 Merge pull request #11301 from bluetech/fixtures-resolve-directness
python: use clearer terminology for `_resolve_arg_value_types`
2023-08-10 09:05:58 +03:00
Ran Benita
3ad3fc6b8f python: use clearer terminology for _resolve_arg_value_types 2023-08-09 20:36:24 +03:00
Sadra Barikbin
09b78737a5 Move fixtures.py::add_funcarg_pseudo_fixture_def to Metafunc.parametrize (#11220)
To remove fixtures.py::add_funcargs_pseudo_fixture_def and add its logic
i.e. registering funcargs as params and making corresponding fixturedefs,
right to Metafunc.parametrize in which parametrization takes place.

To remove funcargs from metafunc attributes as we populate metafunc
params and make pseudo fixturedefs simultaneously and there's no need to
keep funcargs separately.
2023-08-09 17:13:45 +00:00
Ran Benita
b2186e2455 Merge pull request #11268 from bluetech/conftest-load
config: split `_getconftestmodules` and `_loadconftestmodules`
2023-08-08 14:44:29 +03:00
Bruno Oliveira
18bc6c9a0e Merge pull request #11292 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.2.4
build(deps): Bump django from 4.2.3 to 4.2.4 in /testing/plugins_integration
2023-08-07 08:15:17 -03:00
Bruno Oliveira
24c9aa6c30 Merge pull request #11291 from calestyo/improve-duplicate-values-documentation
Improve duplicate values documentation
2023-08-07 08:14:39 -03:00
dependabot[bot]
9c67b7aeb6 build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.2.3 to 4.2.4.
- [Commits](https://github.com/django/django/compare/4.2.3...4.2.4)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 03:39:31 +00:00
Christoph Anton Mitterer
1cc58ed67f improve exception message on duplicate parametrization
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-08-06 17:43:37 +02:00
Christoph Anton Mitterer
84a342e27c doc: parametrize() can be called multiple times only on different args
Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-08-06 17:39:31 +02:00
Sadra Barikbin
e8a8a5f320 python: fix scope assignment for indirect parameter sets (#11277)
Previously, when assigning a scope for a fully-indirect parameter set,
when there are multiple fixturedefs for a param (i.e. same-name fixture
chain), the highest scope was used, but it should be the lowest scope,
since that's the effective scope of the fixture.
2023-08-06 13:59:54 +00:00
Florian Bruhin
1c04a92503 doc: Link pytest.main to how-to guide (#11287) 2023-08-06 12:39:11 +02:00
Christoph Anton Mitterer
cc0adf6bf3 doc: update information about assertion messages (#11285)
It was pointed out[0] that the previous behaviour has been obsoleted by
commit 37bd1e03cb.

[0] https://github.com/pytest-dev/pytest/issues/11265#issuecomment-1666581197

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-08-05 19:30:41 +00:00
Christoph Anton Mitterer
b8b74331b4 Improve docs for Parametrizing conditional raising (#11279)
What one typically actually wants in such a case is both, checking for some
resulting values *and* checking for some expected exception.

Since this is easily possible with the `nullcontext` context manager, adapt the
example accordingly (needlessly using a different name rather just confuses people).

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2023-08-03 13:31:17 -03:00
Sadra Barikbin
4797deab99 Add FixtureArgKey class to represent fixture deps in fixtures.py (#11231) 2023-08-02 14:28:31 +03:00
pre-commit-ci[bot]
c9163402e0 [pre-commit.ci] pre-commit autoupdate (#11269)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](https://github.com/PyCQA/flake8/compare/6.0.0...6.1.0)
- [github.com/asottile/pyupgrade: v3.9.0 → v3.10.1](https://github.com/asottile/pyupgrade/compare/v3.9.0...v3.10.1)

* Use is instead of type comparison with equal to appease the linter

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2023-08-01 23:52:09 +02:00
Ran Benita
01ac13a77d config: split _getconftestmodules and _loadconftestmodules
Previously, the `_getconftestmodules` function was used both to load
conftest modules for a path (during `pytest_load_initial_conftests`),
and to retrieve conftest modules for a path (during hook dispatch and
for fetching `collect_ignore`). This made things muddy - it is usually
nicer to have clear separation between "command" and "query" functions,
when they occur in separate phases.

So split into "load" and "get".

Currently, `gethookproxy` still loads conftest itself. I hope to change
this in the future.
2023-08-01 09:46:17 +03:00
Ran Benita
485c555812 Merge pull request #11138 from bluetech/pkg-mod
python: change `Package` to no longer be a `Module`/`File`
2023-07-28 23:15:08 +03:00
Ran Benita
a21fb87a90 python: change Package to no longer be a Module/File
Fix #11137.
2023-07-28 22:49:24 +03:00
Ran Benita
c754da10d2 Merge pull request #11256 from bluetech/scope-pkg-crash
fixtures: fix crash when `parametrize(scope="package")` is used without a Package
2023-07-28 22:48:47 +03:00
Ran Benita
71e627aa8f fixtures: fix crash when parametrize(scope="package") is used without a Package
There as handling for `scope="class"` without a class, but not for
`scope="package"` without a package. It would fail the assert.
2023-07-28 16:13:02 +03:00
Uday Kumar
d3552ef4c0 Clarify doc for running tests by nodeid section (#11249) 2023-07-28 07:06:38 +00:00
Ran Benita
448563caaa Merge pull request #11253 from bluetech/11243-cherry-picks
11243 cherry picks
2023-07-27 10:19:40 +03:00
Sadra Barikbin
e8aa906e06 fixtures: move _get_direct_parametrize_args to a standalone function
So it can be used independently of the FixtureManager.
2023-07-27 09:38:42 +03:00
Sadra Barikbin
12054a4972 config: avoid list[], set[], dict[]
Should wait with this until Python 3.8 is dropped.
2023-07-27 09:33:34 +03:00
Ran Benita
430ad145c1 Merge pull request #11244 from bluetech/rootdir-tweaks
Rootdir tweaks
2023-07-27 09:16:13 +03:00
Ran Benita
13e2b00258 config: don't pass the entire Config to determine_setup()
Seems better to make the function a bit more pure, and avoids the
circular import.
2023-07-24 00:00:34 +03:00
Ran Benita
4e42421ebf config: fix an incorrect type
Was a mistake in d97d44a97a.
2023-07-24 00:00:34 +03:00
Ran Benita
161ba87300 doc/usage: clarify "Run tests by node ids"
Fix #11107, #11235.
2023-07-24 00:00:25 +03:00
Ran Benita
f2b6040e9e Merge pull request #11238 from bluetech/doc-not-indirect
doc/example/parametrize: a few fixes/improvements
2023-07-23 13:07:40 +03:00
Florian Bruhin
e3247834e2 Remove ep2023 training (#11241) 2023-07-22 20:16:59 +02:00
bowugit
0b4a557087 Extend pytest.raises to support Exception having __repr__ method and initialized with kwargs (#11073)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-07-20 13:29:29 -03:00
Bruno Oliveira
ffdcce67f4 Merge pull request #10927 from RonnyPfannschmidt/pypi-json-for-plugin-list
update-plugin-list: use json, use http caching, use gh action caches
2023-07-20 10:42:32 -03:00
Ronny Pfannschmidt
1ded74739b update-plugin-list: use json, use http caching, use gh action caches
this change
* switches from html index usage to json index usage
* adds using requests-cache as http cache to trim down runtime
* adds gh action caches for pip and the new http cache
2023-07-20 15:04:41 +02:00
Ran Benita
497a1d798a doc/example/parametrize: a few fixes/improvements
Remove "Indirect" from a few section names -- not actually indirect.

Also few minor updates to the related multipython.py example.
2023-07-20 09:51:11 +03:00
Isaac Virshup
1de0923e83 Have pytest.raises match against exception __notes__ (#11227)
The doctest is skipped because add_note is only available in 3.11,

Closes #11223
2023-07-18 08:39:39 -03:00
Ronny Pfannschmidt
7c30f674c5 Merge pull request #11228 from bluetech/fixtures-check-scope-test
fixtures: add a test for a currently non-covered scope mismatch scenario
2023-07-18 08:59:55 +02:00
Ran Benita
396bfbf30b fixtures: add a test for a currently non-covered scope mismatch scenario
This test makes clear the need for the `_check_scope()` call in the
`pytest_setup_fixture` impl in fixtures.py, which otherwise seems
redundant with the one in `_compute_fixture_value`.
2023-07-18 00:01:40 +03:00
Ran Benita
02ba39bfcd Merge pull request #11215 from bluetech/fixtures-tweaks2
fixtures: minor tweaks
2023-07-17 17:30:24 +03:00
Ran Benita
29010d23a6 Merge pull request #11217 from bluetech/fixtures-skip-xunit-loc
fixtures: show test as skip location if skipped from an xunit setup function
2023-07-17 17:30:06 +03:00
dependabot[bot]
de1f6f58ba build(deps): Bump pypa/gh-action-pypi-publish from 1.8.7 to 1.8.8 (#11221)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.7 to 1.8.8.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.7...v1.8.8)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-17 09:31:06 +02:00
dependabot[bot]
cfda801ebf build(deps): Bump pytest-asyncio in /testing/plugins_integration (#11222)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.21.0 to 0.21.1.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.21.0...v0.21.1)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-17 09:27:38 +02:00
Ran Benita
c5262b0c42 fixtures: show test as skip location if skipped from an xunit setup function
Fix #11216.
2023-07-16 23:26:04 +03:00
Ran Benita
ff6e110161 fixtures: remove inaccurate comment
unittest TestCases can also use `usefixtures`. Just remove this comment,
it's not very helpful.
2023-07-16 23:19:33 +03:00
Ran Benita
0e0ed2af95 fixtures: some code comments and minor improvements 2023-07-16 23:19:33 +03:00
Ran Benita
a3fbf24389 unittest: hide access to _request
Let the parent class (Function) do this. Tiny bit better abstraction.
There seems to be no reason for the `hasattr` bit.
2023-07-16 23:19:33 +03:00
Ran Benita
bf451d47a1 Merge pull request #11213 from bluetech/py38-literal
Use typing.Literal without TYPE_CHECKING checks
2023-07-16 23:17:12 +03:00
Ran Benita
578fbe3dfd Merge pull request #11214 from pytest-dev/update-plugin-list/patch-32f480814
[automated] Update plugin list
2023-07-16 13:07:40 +03:00
pytest bot
a668719626 [automated] Update plugin list 2023-07-16 00:28:56 +00:00
Ran Benita
04e0db7e48 Use typing.Literal without TYPE_CHECKING checks
Literal was added in Python 3.8 which we now require so can use it
freely.
2023-07-16 01:11:21 +03:00
Ran Benita
32f480814c Merge pull request #11209 from bluetech/fixtures-doc-comments
fixtures: some tweaks & improvements
2023-07-15 19:40:48 +03:00
Ran Benita
40ed678885 fixtures: remove two unused functions
Not used since 310b67b227.
2023-07-15 10:06:06 +03:00
Ran Benita
fb55615d5e Export FixtureDef
FixtureDef is used in the `pytest_fixture_setup` hook so needs to be
public. However since its current internals are quite dubious (and not
all marked with `_` prefix) I've added an explicit note that only
documented fields/methods are considered public.

Refs #7469.
2023-07-15 10:06:06 +03:00
Ran Benita
9d0ddb4625 fixtures: change FixtureDef.cached_result[2] from exception triplet to exception
Fix #11208.
2023-07-15 10:06:06 +03:00
Ran Benita
01f38aca44 fixtures: expand comments and annotations on fixture internals 2023-07-15 10:06:06 +03:00
Ran Benita
78d81ef865 Merge pull request #11123 from bluetech/new-style-wrappers
Switch to new-style pluggy hook wrappers
2023-07-15 10:03:35 +03:00
Ran Benita
b41acaea12 Switch to new-style pluggy hook wrappers
Fix #11122.
2023-07-14 22:47:48 +03:00
pre-commit-ci[bot]
7008385253 [pre-commit.ci] pre-commit autoupdate (#11195)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0)
- [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](https://github.com/asottile/blacken-docs/compare/1.14.0...1.15.0)
- [github.com/asottile/pyupgrade: v3.8.0 → v3.9.0](https://github.com/asottile/pyupgrade/compare/v3.8.0...v3.9.0)

* Update .pre-commit-config.yaml

* Update .pre-commit-config.yaml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-07-11 11:37:07 +00:00
Ran Benita
b25a3adff5 Merge pull request #11192 from bluetech/py38-extra
A few more Python>=3.8 simplifications
2023-07-11 01:13:17 +03:00
Ran Benita
ecfab4dc8b fixtures: fix a typing ignore TODO
From understanding the code better I see this is the correct fix.
The fixturedefs can be None if `request.getfixturevalue("doesnotexist")`
is used.

In practice there is no change in behavior because this mapping is used
as `self._arg2fixturedefs.get(argname, None)` which ends up the same.
2023-07-11 00:19:29 +03:00
Ran Benita
2c80de532f fixtures: replace a startswith("conftest.py") with == "conftest.py"
I can't imagine why we would want to test for a prefix here.
2023-07-10 23:27:11 +03:00
Ran Benita
7967b2e710 fixtures: change a lambda to partial
It makes for a more debuggable repr. Before:

    <function FixtureRequest._schedule_finalizers.<locals>.<lambda> at 0x7fe4ae32d440>

After:

    functools.partial(<bound method FixtureDef.finish of <FixtureDef argname='hello_package' scope='package' baseid=''>>, request=<SubRequest 'hello_package' for <Function test_hello>>)
2023-07-10 23:27:11 +03:00
Ran Benita
f1c9570a0e A few more Python>=3.8 simplifications 2023-07-10 23:20:11 +03:00
dependabot[bot]
b20e7f6d0c build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#11191)
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.7.0 to 3.7.1.
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.7.0...3.7.1)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 10:23:47 -03:00
dependabot[bot]
b91d5a3112 build(deps): Bump pytest-rerunfailures in /testing/plugins_integration (#11190)
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 11.1.2 to 12.0.
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/11.1.2...12.0)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 10:23:33 -03:00
dependabot[bot]
4e75bff71a build(deps): Bump pypa/gh-action-pypi-publish from 1.8.5 to 1.8.7 (#11189)
Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.5 to 1.8.7.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.5...v1.8.7)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-10 10:23:12 -03:00
antosikv
99ab8ae884 Clarify docs for pytest.main default behavior (#11187)
Add explicit mentions of the default behavior to both API reference and
how-to section about ways to invoke pytest.

Co-authored-by: Ran Benita <ran@unusedvar.com>
2023-07-09 12:30:33 -03:00
Ran Benita
782cacf86b Merge pull request #11184 from pytest-dev/update-plugin-list/patch-fd7a4d242
[automated] Update plugin list
2023-07-09 17:09:12 +03:00
pytest bot
a3b4220d76 [automated] Update plugin list 2023-07-09 00:29:15 +00:00
Bruno Oliveira
fd7a4d2429 Merge pull request #11106 from bluetech/docs-ref-collection-objs
reference: improve the node types docs a bit
2023-07-08 15:41:22 -03:00
Ran Benita
b73ec8e5d1 doc: fix EncodingWarnings in examples (#11158)
Otherwise the warnings show in the regen output.
2023-07-08 15:40:05 -03:00
Zac Hatfield-Dodds
d790e96765 Merge pull request #11178 from kenny-y-dev/add-none-support-approxmapping 2023-07-08 10:40:42 -07:00
Kenny Y
d4265448a5 Update src/_pytest/python_api.py
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-07-08 08:41:42 -04:00
Kenny Y
db37e34613 Merge branch 'main' into add-none-support-approxmapping 2023-07-07 15:55:19 -04:00
Kenny Y
c5b13099e6 Fix error assertion handling in approx when None in dict comparison
Dict comparsion in the ApproxMapping class did not check if values were None before attempting to subtract for max_abs_diff stat, which was throwing an TypeError instead of being handled by pytest error assertion. Check for None has been added before these calculations, so that None will properly show as Obtained/Expected in pytest assert message
2023-07-07 14:42:59 -04:00
Zac Hatfield-Dodds
97ed533f63 Merge pull request #11169 from hugovk/test-me-rm-3.7 2023-07-06 22:28:44 -07:00
Ran Benita
f5a9aa0b84 Merge pull request #11175 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.2.3
build(deps): Bump django from 4.2.2 to 4.2.3 in /testing/plugins_integration
2023-07-06 11:51:44 +03:00
Zac Hatfield-Dodds
901316b3f4 Merge pull request #8502 from mickeypash/patch-2 2023-07-06 00:28:20 -07:00
Zac Hatfield-Dodds
b81003f6fb Incorporate legend into main table 2023-07-06 00:04:15 -07:00
mickeypash
ddd773ecb1 [docs] add table nose x pytest naming comparison 2023-07-05 23:46:32 -07:00
dependabot[bot]
44604f49cd build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.2.2 to 4.2.3.
- [Commits](https://github.com/django/django/compare/4.2.2...4.2.3)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-05 22:57:45 +00:00
Zac Hatfield-Dodds
2203897086 Merge pull request #11173 from bluetech/enc-warning-detox
tox: turn off PYTHONWARNDEFAULTENCODING for pre-commit, sphinx etc.
2023-07-05 09:48:26 -07:00
Ran Benita
119cec0279 tox: turn off PYTHONWARNDEFAULTENCODING for pre-commit, sphinx etc.
Fix #11157.
2023-07-05 19:05:08 +03:00
Florian Bruhin
b5bc53e441 Update open trainings (#11171) 2023-07-04 23:19:24 +02:00
Zac Hatfield-Dodds
084d756ae6 Merge pull request #11143 from tushar-deepsource/patch-1 2023-07-04 10:47:13 -07:00
Zac Hatfield-Dodds
d7dbadbffc Merge pull request #11160 from lesnek/ml/fix/warinings-recorder-pop 2023-07-04 10:20:04 -07:00
Zac Hatfield-Dodds
cb732f7f49 Merge branch 'main' into patch-1 2023-07-04 10:17:06 -07:00
Zac Hatfield-Dodds
7775e494b1 Further tweaks from code review 2023-07-04 10:00:29 -07:00
Hugo van Kemenade
1f5058e972 Use same Black version for blacken-docs as regular Black check 2023-07-04 18:55:08 +03:00
Hugo van Kemenade
6baf9f2d31 Update docs and code after dropping EOL 3.7 2023-07-04 18:55:08 +03:00
Lesnek
c4876c7106 chore(CR): Add changes from code review 2023-07-04 11:49:11 +02:00
Milan Lesnek
6badb6f01e Apply suggestions from code review
chore(changelog): describe better the fix

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
2023-07-04 10:30:19 +02:00
Lesnek
4517af1e28 test(warnings-recorder): Add attribute error test 2023-07-04 10:30:19 +02:00
Lesnek
3d0dedb5ec test(warnings-recorder): Add attribute error test 2023-07-04 10:30:19 +02:00
Lesnek
7b7bd304aa fix(warnings-recorder): Add handling of rest 2023-07-04 10:30:19 +02:00
Lesnek
2706271f66 test(warnings-recorder): Add another warning 2023-07-04 10:30:19 +02:00
Lesnek
8ac3c645fa fix(warnings-recorder): Match also subclass of warning in pop 2023-07-04 10:30:19 +02:00
Lesnek
18e87c9831 test(warnings-recorder): Add non working subclass behaviour of pop 2023-07-04 10:30:19 +02:00
pre-commit-ci[bot]
6995257cf4 [pre-commit.ci] pre-commit autoupdate (#11165)
updates:
- [github.com/asottile/pyupgrade: v3.7.0 → v3.8.0](https://github.com/asottile/pyupgrade/compare/v3.7.0...v3.8.0)
- [github.com/asottile/setup-cfg-fmt: v2.3.0 → v2.4.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.3.0...v2.4.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-04 07:00:14 +00:00
Ronny Pfannschmidt
bea56b30af Switch to deploy environment and configure for pypi oidc (#10925)
Closes #10871
Closes #10870
2023-07-03 12:52:58 -03:00
github-actions[bot]
b847084224 [automated] Update plugin list (#11159)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-07-03 11:45:17 -03:00
Akhilesh Ramakrishnan
024e62e6d2 Added Akhilesh Ramakrishnan to AUTHORS (#11153)
* Added Akhilesh Ramakrishnan to AUTHORS

PR#10338

* Fix typo in changelog
2023-07-03 13:49:50 +02:00
Ronny Pfannschmidt
f9410fddcd Merge pull request #11155 from RonnyPfannschmidt/fix-10447-maker-mro-order-needs-reverse
fix #10447 - consider marks in reverse mro order to give base classes priority
2023-07-02 22:23:00 +02:00
Ronny Pfannschmidt
561f1a993b fix #10447 - consider marks in reverse mro order to give base classes priority 2023-07-01 22:27:18 +02:00
Bruno Oliveira
b77d0deaf5 Fix duplicated imports with importlib mode and doctest-modules (#11148)
The initial implementation (in #7246) introduced the `importlib` mode, which
never added the imported module to `sys.modules`, so it included a test
to ensure calling `import_path` twice would yield different modules.

Not adding modules to `sys.modules` proved problematic, so we began to add the imported module to `sys.modules`
in #7870, but failed to realize that given we are now changing `sys.modules`, we might
as well avoid importing it more than once.

Then #10088 came along, passing `importlib` also when importing application modules
(as opposed to only test modules before), which caused problems due to imports
having side-effects and the expectation being that they are imported only once.

With this PR, `import_path` returns the module immediately if already in
`sys.modules`.

Fix #10811
Fix #10341
2023-07-01 15:37:46 +00:00
akhilramkee
2f7415cfbc Add child modules as attributes of parent modules. (#10338)
Failing to add child modules as attributes of parent module will prevent them from being accessible through parent module.

Fix #10337
2023-07-01 15:12:41 +00:00
Zac Hatfield-Dodds
ba60649680 Merge pull request #11129 from Cheukting/warn_in_expt 2023-06-30 21:58:42 -07:00
Zac Hatfield-Dodds
679bd6f2ed Merge pull request #10937 from reaganjlee/re-emit 2023-06-30 21:21:37 -07:00
Zac Hatfield-Dodds
a50ea1b8e7 Merge pull request #11152 from Zac-HD/drop-py37 2023-06-30 20:56:47 -07:00
Zac Hatfield-Dodds
0353a94cd1 Explicit GC for PyPy, take 2 2023-06-30 20:33:12 -07:00
Zac Hatfield-Dodds
0311fc3384 Apply suggestions from code review
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-06-30 20:18:25 -07:00
Zac Hatfield-Dodds
7fdc8391e2 Explicit GC for PyPy 2023-06-30 16:23:18 -07:00
Cheukting
15524f34d2 capture warning when exception is raised (fix #9036) 2023-06-30 16:04:37 -07:00
Zac Hatfield-Dodds
2d48171e88 Tweak docs on review 2023-06-30 15:29:03 -07:00
Zac Hatfield-Dodds
7022fb455d Update tests for re-emitted warnings 2023-06-30 15:29:03 -07:00
Zac Hatfield-Dodds
a1b37022af Refactor warns() exit logic 2023-06-30 15:29:02 -07:00
Reagan Lee
9279ea2882 Emit unmatched warnings from pytest.warns() 2023-06-30 15:29:02 -07:00
Zac Hatfield-Dodds
165fbbd12a Drop py37 from CI 2023-06-30 15:19:19 -07:00
Zac Hatfield-Dodds
f617bab0a2 Update pre-commit config 2023-06-30 15:07:07 -07:00
Zac Hatfield-Dodds
f4e3b4ad98 Drop Python 3.7 2023-06-30 14:55:42 -07:00
Ran Benita
81cfb3fc87 Merge pull request #11017 from erik-hasse/caplog-root-logger-docs
add a warning about modifying the root logger during tests
2023-06-28 09:28:46 +03:00
pre-commit-ci[bot]
dd5f3773d9 [pre-commit.ci] pre-commit autoupdate (#11145)
updates:
- [github.com/PyCQA/autoflake: v2.1.1 → v2.2.0](https://github.com/PyCQA/autoflake/compare/v2.1.1...v2.2.0)
- [github.com/pre-commit/mirrors-mypy: v1.3.0 → v1.4.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.3.0...v1.4.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-27 05:28:11 +00:00
Ran Benita
e132d6488f Merge pull request #11139 from pytest-dev/update-plugin-list/patch-fe51121f3
[automated] Update plugin list
2023-06-26 15:33:14 +03:00
pre-commit-ci[bot]
4719d998d8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-06-26 11:34:03 +00:00
Tushar Sadhwani
5332656906 Add changelog and author 2023-06-26 17:02:33 +05:30
Tushar Sadhwani
a14fc10cac add a test function to the test 2023-06-26 13:06:11 +05:30
Tushar Sadhwani
05d7e60904 Add test 2023-06-26 12:37:23 +05:30
Tushar Sadhwani
4ebb2b94c2 fix code for py37 2023-06-26 12:19:42 +05:30
Tushar Sadhwani
9859c110cc Ensure the docstring is a string 2023-06-26 12:14:41 +05:30
Zac Hatfield-Dodds
5eaf8207eb Merge pull request #8428 from graingert/warn-when-a-mark-is-applied-to-a-fixture 2023-06-25 10:21:18 -07:00
Thomas Grainger
518ca37cae Update doc/en/deprecations.rst 2023-06-25 16:09:04 +01:00
Thomas Grainger
45f1a462d5 Apply suggestions from code review
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
2023-06-25 16:08:53 +01:00
Thomas Grainger
4cd95eeabf Merge branch 'main' into warn-when-a-mark-is-applied-to-a-fixture 2023-06-25 16:08:11 +01:00
pytest bot
1306b84241 [automated] Update plugin list 2023-06-25 00:27:02 +00:00
Ran Benita
fe51121f39 Merge pull request #11042 from bluetech/pkg-init-argpath
python: change `pytest pkg/__init__.py` to only collect the `__init__.py` Module
2023-06-23 21:09:00 +03:00
Ran Benita
c8b1790ee7 python: change pytest pkg/__init__.py to only collect the __init__.py Module
Previously it would collect the entire package, but this is not what
users expect.

Refs #3749
Fixes #8976
Fixes #9263
Fixes #9313
2023-06-23 20:42:50 +03:00
Ran Benita
2870157234 Merge pull request #11133 from bluetech/removed-in-8-error
Change PytestRemovedIn8Warning to error by default, add PytestRemovedIn9Warning
2023-06-23 20:13:17 +03:00
Ran Benita
1b7896f83d Add PytestRemovedIn9Warning
It's good to have it available already in all 8.* versions, even if it's
not used yet.
2023-06-23 16:42:26 +03:00
Ran Benita
a4a189ad99 Change PytestRemovedIn8Warning to error by default
Per our backward compatibility policy.
2023-06-23 16:42:24 +03:00
Ran Benita
57d352460c Merge pull request #11132 from bluetech/cherry-pick-release
Cherry-pick 7.4.0 release notes
2023-06-23 14:48:46 +03:00
Ran Benita
a14745550a Merge pull request #11131 from pytest-dev/release-7.4.0
Prepare release 7.4.0

(cherry picked from commit fb03d1388b)
2023-06-23 14:19:51 +03:00
Ran Benita
64319dbc01 Merge pull request #11128 from bluetech/pythonpath-note
reference: add note that `pythonpath` does not affect `-p`
2023-06-22 18:12:37 +03:00
Ran Benita
1e8135df16 reference: add note that pythonpath does not affect -p
Fix #11118.
2023-06-22 15:45:20 +03:00
Zac Hatfield-Dodds
1e32a4b570 Merge pull request #10935 from nondescryptid/10328 2023-06-21 11:04:10 -07:00
Ran Benita
faa1f9d2ad Merge pull request #11125 from bluetech/initial-conftests-testpaths
config: fix the paths considered for initial conftest discovery
2023-06-21 09:21:27 +03:00
Ran Benita
14890329dc config: fix the paths considered for initial conftest discovery
Fixes #11104.

See the issue for a description of the problem.

Now, we use the same logic for initial conftest paths as we do for
deciding the initial args, which was the idea behind checking
`namespace.file_or_dir` and `testpaths` previously.

This fixes the issue of `testpaths` being considered for initial
conftests even when it's not used for the args.

(Another issue in faeb16146b was that the
`testpaths` were not glob-expanded, this is also fixed.)
2023-06-21 09:01:42 +03:00
Ran Benita
d97d44a97a config: extract initial paths/nodeids args logic to a function
Will be reused in the next commit.
2023-06-20 21:28:48 +03:00
Zac Hatfield-Dodds
f6b995e9d5 Use utf-8 debug file 2023-06-20 04:55:40 -07:00
Zac Hatfield-Dodds
661b938fca Add encoding in more tests 2023-06-20 04:55:40 -07:00
Zac Hatfield-Dodds
7e510769b4 Encoding for subprocess.run 2023-06-20 04:55:39 -07:00
nondescryptid
a704605cf1 Fix encoding warnings 2023-06-20 04:55:39 -07:00
pre-commit-ci[bot]
797b924fc4 [pre-commit.ci] pre-commit autoupdate (#11124)
updates:
- [github.com/asottile/blacken-docs: 1.13.0 → 1.14.0](https://github.com/asottile/blacken-docs/compare/1.13.0...1.14.0)
- [github.com/asottile/reorder-python-imports: v3.9.0 → v3.10.0](https://github.com/asottile/reorder-python-imports/compare/v3.9.0...v3.10.0)
- [github.com/asottile/pyupgrade: v3.6.0 → v3.7.0](https://github.com/asottile/pyupgrade/compare/v3.6.0...v3.7.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-20 06:38:36 +00:00
Zac Hatfield-Dodds
b5ec092525 Merge pull request #9149 from Vijay-Arora/main 2023-06-19 20:35:01 -07:00
Zac Hatfield-Dodds
5b35518389 Apply suggestions from code review
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
2023-06-19 20:06:21 -07:00
dependabot[bot]
8528052a95 build(deps): Bump peter-evans/create-pull-request from 5.0.0 to 5.0.2 (#11120)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5.0.0 to 5.0.2.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](5b4a9f6a9e...153407881e)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-19 19:22:49 -03:00
dependabot[bot]
1eb83706b6 build(deps): Bump pytest-mock in /testing/plugins_integration (#11119)
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.10.0 to 3.11.1.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.10.0...v3.11.1)

---
updated-dependencies:
- dependency-name: pytest-mock
  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>
2023-06-19 04:15:50 +00:00
github-actions[bot]
fa09f6dcc6 [automated] Update plugin list (#11117)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-06-18 09:40:52 -03:00
Florian Bruhin
b55c02c3c9 doc: Add ep2023 training (#11113) 2023-06-15 14:17:14 +02:00
Ran Benita
bd88a6412d reference: separate node types to their own section
I think it's helpful to separate the node classes from the other
objects, as they have their own unique usage.

I've chosen not to alphabetize the order, but to use a logical order
instead.

Also slightly improve the docstrings.
2023-06-14 15:57:56 +03:00
Ran Benita
264e7ac327 reference: add doc for Package
We document the other py collectors, we should document `Package` as
well.
2023-06-14 09:51:37 +03:00
pre-commit-ci[bot]
b7a142f4ba [pre-commit.ci] pre-commit autoupdate (#11103)
updates:
- [github.com/asottile/pyupgrade: v3.4.0 → v3.6.0](https://github.com/asottile/pyupgrade/compare/v3.4.0...v3.6.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-13 05:36:28 +00:00
dependabot[bot]
2d824329eb build(deps): Bump django in /testing/plugins_integration (#11102)
Bumps [django](https://github.com/django/django) from 4.2.1 to 4.2.2.
- [Commits](https://github.com/django/django/compare/4.2.1...4.2.2)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 04:19:01 +00:00
Ran Benita
ecb23106d8 Merge pull request #11097 from bluetech/cherry-pick-release
Cherry-pick 7.3.2 release notes
2023-06-10 22:57:31 +03:00
Ran Benita
8174a30164 changelog: add note to norecursedir/pytest_ignore_collect change (#11095) 2023-06-10 19:34:59 +00:00
Ran Benita
0142bb6687 Merge pull request #11096 from pytest-dev/release-7.3.2
Prepare release 7.3.2

(cherry picked from commit 5dcd2be466)
2023-06-10 22:31:49 +03:00
Ran Benita
52cf700f1b Merge pull request #10894 from pytest-dev/py312-ci
Python 3.12 support
2023-06-10 20:46:02 +03:00
Ran Benita
6b3ece5bdb ci; use check-latest: true for -dev pythons
When testing -dev python versions, we want to always use the latest.
2023-06-09 11:29:15 +03:00
Ran Benita
4059000834 testing/python/collect: replace use of deprecated/removed imp module 2023-06-07 17:05:52 +03:00
Ran Benita
7d5207a736 Declare support for Python 3.12 2023-06-07 17:05:52 +03:00
Ran Benita
3e65a461c7 ci: start testing Python 3.12-dev 2023-06-07 17:05:52 +03:00
Ran Benita
fc3b5b2610 testing: install setuptools to fix pkg_resources import in a test
Since Python 3.12, setuptools is no longer installed by default in
venvs. We have a test which uses it, so add it to the testing extra.
2023-06-07 17:05:52 +03:00
Ran Benita
9335a0b445 Avoid ast deprecation warnings on Python 3.12
Fix #10977.
2023-06-07 17:05:52 +03:00
Ran Benita
0ded3297a9 Merge pull request #11086 from pytest-dev/update-plugin-list/patch-32de8e289
[automated] Update plugin list
2023-06-07 09:02:06 +03:00
pytest bot
fc9cbbd4c4 [automated] Update plugin list 2023-06-06 14:05:44 +00:00
Ran Benita
1a17539065 Merge pull request #10853 from stefmolin/patch-1
Update fixture scope in package/directory fixture example.
2023-06-06 17:04:45 +03:00
Ran Benita
32de8e2893 Merge pull request #11082 from bluetech/norecursedir-in-hook
main: move norecursedir check to main's pytest_ignore_collect
2023-06-06 12:44:03 +03:00
Ran Benita
5d4a342a7a Merge pull request #11076 from pytest-dev/update-plugin-list/patch-b5ff089d2
[automated] Update plugin list
2023-06-06 12:37:46 +03:00
Facundo Batista
1790f17228 Introduced a hardcoded list of project to include as plugins beyond those found by their names. (#11077) 2023-06-06 12:15:57 +03:00
pre-commit-ci[bot]
ee8baa2676 [pre-commit.ci] pre-commit autoupdate (#11084)
updates:
- [github.com/asottile/setup-cfg-fmt: v2.2.0 → v2.3.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.2.0...v2.3.0)
2023-06-06 12:13:38 +03:00
Ran Benita
ae38b076da main: move norecursedir check to main's pytest_ignore_collect
Fix #11081
2023-06-05 17:21:45 +03:00
dependabot[bot]
85c5bd26b6 build(deps): Bump pytest-xvfb in /testing/plugins_integration (#11079)
Bumps [pytest-xvfb](https://github.com/The-Compiler/pytest-xvfb) from 2.0.0 to 3.0.0.
- [Changelog](https://github.com/The-Compiler/pytest-xvfb/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/The-Compiler/pytest-xvfb/compare/v2.0.0...v3.0.0)

---
updated-dependencies:
- dependency-name: pytest-xvfb
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-05 12:06:55 +02:00
Ran Benita
e1204e1e23 Merge pull request #11078 from bluetech/pkg-roots-path
main: change pkg_roots to work with `Path`s instead of string paths
2023-06-04 21:45:45 +03:00
Ran Benita
313b61471f main: change pkg_roots to work with Paths instead of string paths
- Works better on Windows (case sensitivity)
- Simpler code
2023-06-04 20:43:34 +03:00
pytest bot
1daa8129c6 [automated] Update plugin list 2023-06-04 00:26:58 +00:00
Ran Benita
b5ff089d2c Merge pull request #11069 from bluetech/lf-file
cacheprovider: make file-skipping work with any File, not just Modules
2023-06-03 18:50:50 +03:00
Ran Benita
fda8024622 cacheprovider: make file-skipping work with any File, not just Modules
No reason for `--lf`'s whole-file-skipping feature to not for for
non-Python files.

Fix #11068.
2023-06-03 09:32:26 +03:00
Ran Benita
4b823a42ce Merge pull request #11059 from bluetech/lf-skip-across
cacheprovider: fix file-skipping functionality across packages
2023-06-03 09:31:04 +03:00
Ran Benita
6c9b277ce4 Merge pull request #11070 from bluetech/pkg-redundant-methods
python: remove redundant methods from Package
2023-06-02 18:58:21 +03:00
Ran Benita
3de43e5102 python: remove redundant methods from Package
They are already inherited exactly the same from FSCollector.
2023-06-02 16:08:04 +03:00
Ran Benita
c76ae74bd7 cacheprovider: fix file-skipping functionality across packages
Continuation of fc538c5766.
Fixes #11054 again.
2023-05-30 23:16:43 +03:00
Ran Benita
24534cdd29 Merge pull request #11043 from bluetech/confcutdir-rootpath
config: fallback confcutdir to rootpath if inipath is not set
2023-05-30 20:21:20 +03:00
Ran Benita
99c78aa93a Merge pull request #10921 from bluetech/tb-simplify-2
Fix hidden traceback entries of chained exceptions getting shown
2023-05-30 20:09:13 +03:00
Ran Benita
3a6bdcd76b Merge pull request #11055 from bluetech/lf-skipped-package
cacheprovider: fix file-skipping feature for files in packages
2023-05-30 20:04:06 +03:00
Ran Benita
4a1bba25b9 config: fallback confcutdir to rootpath if inipath is not set
Currently, if `--confcutdir` is not set, `inipath.parent` is used, and
if `initpath` is not set, then `confcutdir` is None, which means there
is no cutoff.

Having no cutoff is not great, it means we potentially start probing
stuff all the way up to the filesystem root directory. So let's add
another fallback, to `rootpath`, which is always something reasonable.
2023-05-30 19:52:59 +03:00
Alessio Izzo
9e1add75f7 Fix warlus operator behavior when called by a function (#11041)
In #10758 we introduced the support for the use of the walrus operator in the test cases. There was a case which was not handled that caused a bug report #11028. This PR aims to fix the issue and also to improve how the walrus operator is handled in the AssertionRewriter class.

Closes #11028
2023-05-30 11:59:24 -03:00
theirix
4da9026766 Handle microseconds with custom logging.Formatter (#11047)
Added handling of %f directive to print microseconds in log format options, such as log-date-format. It is impossible to do with a standard logging.Formatter because it uses time.strftime which doesn't know about milliseconds and %f. In this PR I added a custom Formatter which converts LogRecord to a datetime.datetime object and formats it with %f flag. This behaviour is enabled only if a microsecond flag is specified in a format string.

Also added a few tests to check the standard and changed behavior.

Closes #10991
2023-05-30 09:35:33 -03:00
Kenny Y
7c231baa64 Add warning when testpaths is set but paths are not found by glob (#11044)
Closes #11013

---------

Co-authored-by: Ran Benita <ran@unusedvar.com>
2023-05-30 07:06:13 -03:00
Ran Benita
fc538c5766 cacheprovider: fix file-skipping feature for files in packages
`--lf` has a feature where if a certain `Module` (python file) does not
contain any failed tests, it is skipped entirely at the collector level
instead of being collected and each item skipped individually. When this
happens the collection summary looks like this:

    run-last-failure: rerun previous 1 failure (skipped 1 file)

However, this feature didn't work for `Module`s inside of `Package`s,
only for those directly beneath the `Session`.

Fix #11054.
2023-05-29 22:55:44 +03:00
dependabot[bot]
fbfd4b5005 build(deps): Bump anyio[curio,trio] in /testing/plugins_integration (#11050)
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.6.2 to 3.7.0.
- [Changelog](https://github.com/agronholm/anyio/blob/3.7.0/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.6.2...3.7.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  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>
2023-05-29 07:55:42 +02:00
dependabot[bot]
ec752537ea build(deps): Bump pytest-cov in /testing/plugins_integration (#11051)
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 4.0.0 to 4.1.0.
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v4.0.0...v4.1.0)

---
updated-dependencies:
- dependency-name: pytest-cov
  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>
2023-05-29 07:55:13 +02:00
Ran Benita
dd667336ce nodes: apply same traceback filtering for chained exceptions as main exception
Fix #1904.
2023-05-28 17:20:50 +03:00
Ran Benita
29d16d2939 Merge pull request #11046 from pytest-dev/update-plugin-list/patch-4f3f36c39
[automated] Update plugin list
2023-05-28 16:02:07 +03:00
pytest bot
5313d50e18 [automated] Update plugin list 2023-05-28 00:22:05 +00:00
Chris Mahoney
4f3f36c396 Add alias --config-file to -c (#11036)
Fixes #11031

Signed-off-by: Chris Mahoney <chrismahoey@hotmail.com>
Co-authored-by: Chris Mahoney <chrismahoey@hotmail.com>
2023-05-26 07:56:18 -03:00
Ran Benita
af124c7f21 Merge pull request #11026 from bluetech/small-fixes
Small fixes and improvements
2023-05-24 21:44:03 +03:00
Bruno Oliveira
4e6d53fef5 Merge pull request #11033 from jkeifer/patch-1
nonpython example now repr all exceptions
2023-05-24 08:10:42 -03:00
Jarrett Keifer
751d726d21 nonpython example now repr all exceptions
The definition of `repr_failure` on the `YamlItem` subclass only handled the custom `YamlException` class, which hides all other errors from the user. By adding in the `super` call we ensure all other exception types also appropriately handled by `repr_failure`.
2023-05-23 20:06:05 -07:00
github-actions[bot]
9e491f430e [automated] Update plugin list (#11027)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-05-21 10:47:02 -03:00
Ran Benita
63f258f432 python: fix syntax typo 2023-05-20 21:14:29 +03:00
Ran Benita
baaa67dfb9 python: simplify code in Package.collect()
The path of Package is already the `__init__.py` file, and we're already
assured it's a file.
2023-05-20 21:14:29 +03:00
Ran Benita
519f351b4f pathlib: extract scandir utility from visit
Will be used on its in some upcoming changes, but good on its own.
2023-05-20 21:14:29 +03:00
Ran Benita
5d53447a73 fixtures: use isinstance in get_scope_package
No reason for the exact type equality.
2023-05-20 21:13:48 +03:00
Ran Benita
1716d3c9bf fixtures: type annotate get_scope_package 2023-05-20 21:06:24 +03:00
Ran Benita
ac699e7b25 fixtures: add type annotations and docstring to parsefactories 2023-05-20 21:06:13 +03:00
Ran Benita
a5f37199a9 fixtures: inline FixtureRequest._addfinalizer
There are no longer any calls to `_addfinalizer` other than this one
place, so inline it.
2023-05-20 21:06:07 +03:00
Roberto Aldera
9fa82598a9 Use NamedTuple for pytest_report_teststatus return value (#10972)
Closes #10872

---------

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-05-19 08:24:28 -03:00
Erik Hasse
a2feb6bd00 add a warning about modifying the root logger during tests 2023-05-18 09:26:16 -05:00
Alex Lambson
ba32a3bd87 Handle disabled logging in 'caplog.set_level' and 'caplog.at_level' (#8758)
Forces requested `caplog` logging levels to be enabled if they were disabled via `logging.disable()`

`[attr-defined]` mypy error ignored in `logging.py` because there were existing errors with the imports
and `loggin.Logger.manager` is an attr set at runtime. Since it's in the standard lib I can't really fix that.

Ignored an attr-defined error in `src/_pytest/config/__init__.py` because the re-export is necessary.

Fixes #8711
2023-05-18 10:18:59 -03:00
Ville Skyttä
c8641f879f Include reason in cache path warnings to aid debugging (#11005)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-05-18 10:11:47 -03:00
Ville Skyttä
6041511fb4 Spelling and grammar fixes (#11014) 2023-05-18 10:10:44 -03:00
Ronny Pfannschmidt
739408b958 Merge pull request #11009 from nicoddemus/reference-status-of-python-versions
Reference "Status of Python Versions" in backwards-compatibility policy
2023-05-17 09:51:30 +02:00
Bruno Oliveira
1636322995 Reference "Status of Python Versions" in backwards-compatibility policy
As suggested in #10981.
2023-05-16 20:24:06 -03:00
pre-commit-ci[bot]
b8edacb8f1 [pre-commit.ci] pre-commit autoupdate (#11007)
updates:
- [github.com/pre-commit/mirrors-mypy: v1.2.0 → v1.3.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.2.0...v1.3.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-05-16 09:19:38 +02:00
github-actions[bot]
612489e2bd [automated] Update plugin list (#11001)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-05-15 08:26:41 -03:00
dependabot[bot]
383774db10 build(deps): Bump actions/stale from 5 to 8 (#11003)
Bumps [actions/stale](https://github.com/actions/stale) from 5 to 8.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v5...v8)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 07:29:18 +02:00
Adam J. Stewart
3b5b3cf50e monkeypatch: add support for TypedDict (#11000) 2023-05-14 22:17:00 +03:00
Bruno Oliveira
23e343af60 Fix close stale issues workflow (#10990)
Fixed how the label is configured.
2023-05-14 08:39:45 -03:00
Ronny Pfannschmidt
f9a995b56d Merge pull request #10998 from bluetech/pre-commit-rm-default
pre-commit: remove `default_language_version` setting
2023-05-13 23:27:48 +02:00
Ran Benita
d9d78a8aef pre-commit: remove default_language_version setting
This makes it difficult to run on newer python versions than the one
specified.
2023-05-13 22:24:30 +03:00
Bruno Oliveira
76d15231f5 Merge pull request #10988 from nicoddemus/initial-testpaths-10987
Consider testpaths for initial conftests
2023-05-12 09:58:59 -03:00
Bruno Oliveira
4cc05e7bee Fix trailing whitespace in .github/workflows/stale.yml 2023-05-12 09:34:44 -03:00
Bruno Oliveira
2d57d5c32f Do not break on very long command-line options
`_set_initial_conftests` could break on some systems if a very long
option was passed, because the `Path.exists()` call raises an
`OSError` instead of returning `False`.

Fix #10169
2023-05-12 09:34:15 -03:00
Bruno Oliveira
faeb16146b Consider testpaths for initial conftests
The 'testpaths' option is meant to be identical to execute
pytest passing the 'testpaths' directories explicitly.

Fix #10987
2023-05-12 09:34:15 -03:00
Bruno Oliveira
b241c0b479 Fix defaults for tmp_path_retention_count and tmp_path_retention_policy in docs 2023-05-12 09:34:15 -03:00
Bruno Oliveira
78403237cf Add workflow to close "needs information" labeled issues (#10986)
This introduces a workflow to automatically close issues with the label
`status: needs information` after a number of days of inactivity.

This work has been done manually for a number of years, but I think it is safe
to close issues with this label automatically.

Not tested yet, but it is in `debug-only` mode so we can watch what it does before
deciding to turn it on (however it needs to be in `main` for it to run).
2023-05-11 15:14:50 -03:00
leeyueh
f84fea0888 Update usage.rst (#10974)
Added a note for single quotation used in Windows.
2023-05-10 22:28:52 -03:00
Ran Benita
271bdf6c23 Merge pull request #10979 from bluetech/faulthandler-no-encoding
faulthandler: avoid accessing sys.stderr.encoding
2023-05-10 14:17:54 +03:00
Ran Benita
fd56968f2b Merge pull request #10970 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.2.1
build(deps): Bump django from 4.2 to 4.2.1 in /testing/plugins_integration
2023-05-10 10:18:17 +03:00
Ran Benita
5b75b0d03f Merge pull request #10978 from bzoracler/fix-pytest-code-import
fix reference to non-existent module
2023-05-10 10:15:20 +03:00
Ran Benita
aac5d5d08b faulthandler: avoid accessing sys.stderr.encoding
Fixes a pytest-xdist regression after
762bb61562 (not yet released).

pytest-xdist patches sys.stderr with an object which doesn't have
`encoding`. Strictly speaking, this should be fixed there (or more
precisely, in execnet), but it will drop support for older versions
which don't want.

But in any case, the fix turns out to simplify the code, using FD
support added in Python 3.5, so it's good anyway!

Refs: https://github.com/pytest-dev/pytest-xdist/pull/900
2023-05-10 09:59:57 +03:00
bzoracler
b1460f3261 fix reference to non-existent module 2023-05-10 10:48:20 +12:00
github-actions[bot]
a88ae8289c [automated] Update plugin list (#10968)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-05-09 19:05:13 -03:00
pre-commit-ci[bot]
62320e4ff7 [pre-commit.ci] pre-commit autoupdate (#10975)
updates:
- https://github.com/asottile/reorder_python_importshttps://github.com/asottile/reorder-python-imports
- [github.com/asottile/pyupgrade: v3.3.2 → v3.4.0](https://github.com/asottile/pyupgrade/compare/v3.3.2...v3.4.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-05-09 11:22:50 +02:00
dependabot[bot]
6514041a35 build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.2 to 4.2.1.
- [Commits](https://github.com/django/django/compare/4.2...4.2.1)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-08 03:56:49 +00:00
Brian Larsen
7d548c38e2 Improve verbose output by wrapping skip/xfail reasons with margin (#10958)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-05-06 12:15:11 -03:00
Bruno Oliveira
07eeeb8dfc Merge pull request #10957 from pytest-dev/update-plugin-list/patch-762bb6156
[automated] Update plugin list
2023-05-02 10:02:58 -04:00
pytest bot
be774667c2 [automated] Update plugin list 2023-04-30 00:23:40 +00:00
Ran Benita
762bb61562 Fix couple of EncodingWarnings (#10954)
* faulthandler: fix an EncodingWarning

* _py/path: tiny change to `ensure` to silence EncodingWarning

We're not supposed to diverge here, but make this change to fix an
unavoidable EncodingWarning that is otherwise raised in pytest's test
suite. The behavior should be exactly the same besides the warning,
hopefully that won't cause confusion.
2023-04-29 11:37:22 +03:00
Sergey Kim
725de3a0d3 add flake8-pytest-style mention to goodpractices (#10939) 2023-04-28 23:47:47 +03:00
Ran Benita
fcada1ea47 nodes: change _prunetraceback to return the new traceback instead of modifying excinfo
This makes it usable as a general function, and just more understandable
in general.
2023-04-28 11:47:45 +03:00
Ran Benita
6f7f89f3c4 code: make TracebackEntry immutable
TracebackEntry being mutable caught me by surprise and makes reasoning
about the exception formatting code harder. Make it a proper value.
2023-04-28 11:47:45 +03:00
Ran Benita
0a20452f78 code: inline Traceback.getcrashentry into ExceptionInfo._getreprcrash
Since `Traceback.getcrashentry` takes the `ExceptionInfo`, it is not
really independent of it and is in the wrong layer. Prevent nonsensical
mistakes by inlining it.
2023-04-28 11:47:45 +03:00
Ran Benita
cc23ec91d0 code: stop storing weakref to ExceptionInfo on Traceback and TracebackEntry
TracebackEntry needs the excinfo for the `__tracebackhide__ = callback`
functionality, where `callback` accepts the excinfo.

Currently it achieves this by storing a weakref to the excinfo which
created it. I think this is not great, mixing layers and bloating the
objects.

Instead, have `ishidden` (and transitively, `Traceback.filter()`) take
the excinfo as a parameter.
2023-04-28 11:47:45 +03:00
Florian Bruhin
a15f544962 doc: Fix 2024 training location (#10947) 2023-04-26 08:13:06 +02:00
pre-commit-ci[bot]
3823ce60dd [pre-commit.ci] pre-commit autoupdate (#10941)
updates:
- [github.com/PyCQA/autoflake: v2.1.0 → v2.1.1](https://github.com/PyCQA/autoflake/compare/v2.1.0...v2.1.1)
- [github.com/asottile/pyupgrade: v3.3.1 → v3.3.2](https://github.com/asottile/pyupgrade/compare/v3.3.1...v3.3.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-25 10:52:15 +02:00
Miro Hrončok
e03f82c359 Filter new pkg_resources deprecations (#10938)
Fixes https://github.com/pytest-dev/pytest/issues/10815
2023-04-25 10:51:10 +02:00
Bryan Ricker
158f41fdf8 Fix documentation typo (#10942) 2023-04-25 10:49:16 +02:00
Bruno Oliveira
fd6a4507ac Merge pull request #10936 from pytest-dev/update-plugin-list/patch-0860f4e91
[automated] Update plugin list
2023-04-22 22:42:05 -03:00
pytest bot
15156757b6 [automated] Update plugin list 2023-04-23 00:21:26 +00:00
Florian Bruhin
0860f4e916 Add 2024 pytest training (#10933) 2023-04-22 21:22:25 +02:00
Ran Benita
11965d1c27 Merge pull request #10920 from bluetech/testing-no-testdir
testing: remove usages of testdir that sneaked back in
2023-04-18 22:49:23 +03:00
pre-commit-ci[bot]
14be71b234 [pre-commit.ci] pre-commit autoupdate (#10926)
updates:
- [github.com/PyCQA/autoflake: v2.0.2 → v2.1.0](https://github.com/PyCQA/autoflake/compare/v2.0.2...v2.1.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-18 07:03:27 +02:00
dependabot[bot]
2d6206b89a build(deps): Bump pytest-sugar in /testing/plugins_integration (#10922)
Bumps [pytest-sugar](https://github.com/Teemu/pytest-sugar) from 0.9.5 to 0.9.7.
- [Release notes](https://github.com/Teemu/pytest-sugar/releases)
- [Changelog](https://github.com/Teemu/pytest-sugar/blob/main/CHANGES.rst)
- [Commits](https://github.com/Teemu/pytest-sugar/commits/v0.9.7)

---
updated-dependencies:
- dependency-name: pytest-sugar
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-17 08:55:36 +02:00
Alex
41f57ef95d Fix pytrace=False and --tb=line reports None (#10905)
Closes #10831.

This fixes a small bug where running tests that contained
`pytest.fail(pytrace=False)` with the `--tb=line` flag set results in
 an output of "None" in the Failures section of the output, and adds
 a test to ensure the behavior is correct.
2023-04-16 20:31:45 +00:00
Ran Benita
4eca6063c8 Merge pull request #10918 from pytest-dev/update-plugin-list/patch-7834b3b07
[automated] Update plugin list
2023-04-16 19:40:51 +03:00
Ran Benita
819f5abd73 testing: remove usages of testdir that sneaked back in 2023-04-16 19:18:50 +03:00
Ran Benita
adf891ab1d Merge pull request #10919 from bluetech/missing-changelog
doc: add missing changelog for #10907
2023-04-16 18:41:45 +03:00
Ran Benita
f08184ba20 doc: add missing changelog for #10907 2023-04-16 18:22:51 +03:00
pytest bot
28783e5d23 [automated] Update plugin list 2023-04-16 00:21:39 +00:00
Bruno Oliveira
7834b3b07f Merge pull request #10914 from nicoddemus/cherry-pick-release-7.3.1
Merge pull request #10913 from pytest-dev/release-7.3.1
2023-04-14 15:19:13 -03:00
Bruno Oliveira
ece756fcb4 Merge pull request #10913 from pytest-dev/release-7.3.1
Prepare release 7.3.1

(cherry picked from commit a1f7a204df)
2023-04-14 15:15:28 -03:00
Bruno Oliveira
d380771065 Fix tmp_path regression introduced in 7.3.0 (#10911)
The problem is that we would loop over all directories of the basetemp directory searching for dead symlinks, for each test, which would compound over the test session run.

Doing the cleanup just once, at the end of the session, fixes the problem.

Fix #10896
2023-04-14 13:24:12 -03:00
Ran Benita
b893d2a0fe Merge pull request #10907 from bluetech/empty-traceback
code: handle repr'ing empty tracebacks gracefully
2023-04-13 19:36:09 +03:00
Ran Benita
e3b1799766 code: handle repr'ing empty tracebacks gracefully
By "empty traceback" I mean a traceback all of whose entries have been
filtered/cut/pruned out.

Currently, if an empty traceback needs to be repr'ed, the last entry
before the filtering is used instead (added in
accd962c9f).

Showing a hidden frame is not so good IMO. This commit does the
following instead:

1. Shows details of the exception.
2. Shows a message about how the full trace can be seen.

Example:

```
_____________ test _____________

E   ZeroDivisionError: division by zero
All traceback entries are hidden. Pass `--full-trace` to see hidden and internal frames.
```

Also handles `--tb=native`, though there the `--full-trace` bit is not
shown.

This commit contains some pieces from
431ec6d34e (which has been reverted).

Helps towards fixing issue # 1904.

Co-authored-by: Felix Hofstätter <Felhof1@hotmail.com>
2023-04-13 19:11:37 +03:00
Ran Benita
5d1385320f Merge pull request #10901 from bluetech/exceptioninfo-from-exception
code: add `ExceptionInfo.from_exception`
2023-04-13 16:04:48 +03:00
Ran Benita
eff54aece1 Merge pull request #10904 from bluetech/revert-10772
Revert "Correctly handle tracebackhide for chained exceptions (#10772)"
2023-04-13 14:51:57 +03:00
Ran Benita
bc1fc3f0fc Merge branch 'main' into exceptioninfo-from-exception 2023-04-13 14:51:07 +03:00
Ran Benita
784ffa0fad Merge pull request #10900 from bluetech/exceptioninfo-from_exc_info-exp
code: drop Experimental API label from ExceptionInfo.from_exc_info
2023-04-13 14:48:56 +03:00
Ran Benita
90412827c3 Revert "Correctly handle tracebackhide for chained exceptions (#10772)"
This reverts commit 431ec6d34e.

Fix #10903.
Reopen #1904.
2023-04-12 19:23:25 +03:00
Ran Benita
424c3eebde code: add ExceptionInfo.from_exception
The old-style `sys.exc_info()` triplet is redundant nowadays with
`(type(exc), exc, exc.__traceback__)`, and is beginning to get
soft-deprecated in Python 3.12.

Add a nicer API to ExceptionInfo which takes just the exc instead of the
triplet. There are already a few internal uses which benefit.
2023-04-12 13:16:48 +03:00
Ran Benita
9c2247ec1b code: drop Experimental API label from ExceptionInfo.from_exc_info
This API is OK, I don't think we're going to change something about it
at this point.
2023-04-12 12:46:29 +03:00
Ran Benita
61f7c27ec0 Merge pull request #10893 from bluetech/py312
Python 3.12 alpha fixes
2023-04-11 23:54:47 +03:00
Ran Benita
1b81d636e2 unittest: add addDuration function for Python 3.12 support
Fix #10875

Without this, fails with

```
...
E           AttributeError: 'TestCaseFunction' object has no attribute 'addDuration'
...
E           RuntimeWarning: TestResult has no addDuration method
```
2023-04-11 13:24:32 +03:00
Ran Benita
1b196fbeaf pathlib: fix Python 3.12 rmtree(onerror=...) deprecation
Fixes #10890
Ref: https://docs.python.org/3.12/library/shutil.html#shutil.rmtree
2023-04-11 13:24:32 +03:00
pre-commit-ci[bot]
22524046cf [pre-commit.ci] pre-commit autoupdate (#10891)
updates:
- [github.com/pre-commit/mirrors-mypy: v1.1.1 → v1.2.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.1.1...v1.2.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-11 07:08:45 +02:00
Bruno Oliveira
6dcd652d4a Amend changelog note for removal of attrs (#10888)
As discussed in https://github.com/pytest-dev/pytest/pull/10669#issuecomment-1501497729, we should
make the reasoning behind this change more clear, as well as thank the attrs maintainers for the
many years of cooperation and support.

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2023-04-10 13:04:02 -03:00
dependabot[bot]
be9faa68d8 build(deps): Bump peter-evans/create-pull-request from 4.2.4 to 5.0.0 (#10887)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.2.4 to 5.0.0.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](38e0b6e68b...5b4a9f6a9e)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-10 08:25:35 -03:00
dependabot[bot]
e4e13dd913 build(deps): Bump django in /testing/plugins_integration (#10886)
Bumps [django](https://github.com/django/django) from 4.1.7 to 4.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.1.7...4.2)

---
updated-dependencies:
- dependency-name: django
  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>
2023-04-10 08:21:27 -03:00
Ran Benita
5a399030c1 Merge pull request #10884 from pytest-dev/update-plugin-list/patch-ec8e23951
[automated] Update plugin list
2023-04-09 11:11:02 +03:00
Ran Benita
19c8ef63a4 Merge pull request #10880 from bluetech/regen-rm-dataclasses-dep
tox: remove `dataclasses` dependency from `regen`
2023-04-09 10:46:11 +03:00
pytest bot
22951bba67 [automated] Update plugin list 2023-04-09 00:22:30 +00:00
Ran Benita
ec8e23951d Merge pull request #10883 from bluetech/cherry-pick-release
Cherry pick 7.3.0 release notes
2023-04-09 00:53:52 +03:00
Ran Benita
bf47357511 Merge pull request #10881 from pytest-dev/release-7.3.0
Prepare release 7.3.0

(cherry picked from commit cec5bfe058)
2023-04-09 00:50:37 +03:00
Ran Benita
2d2dc4a2a8 tox: remove dataclasses dependency from regen
This dep is not needed on newer Pythons.
2023-04-09 00:18:07 +03:00
Kodi Arfer
3683722bcb FormattedExcinfo.get_source: avoid crash when line number is out-of-bounds/negative
pytest could crash given pathological AST position attributes, which shouldn't happen when testing real Python code, but could happen when testing AST produced by e.g. Hylang.

Another example of the failure is in the nightly CI for the JAX project: https://github.com/google/jax/actions/runs/4607513902/jobs/8142126075

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Jake VanderPlas <jakevdp@google.com>
2023-04-05 22:48:24 -03:00
github-actions[bot]
31d0b51039 [automated] Update plugin list (#10857)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-04-04 13:17:43 -03:00
Pierre Sassoulas
2d2f69dab5 Merge pull request #10862 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-04-04 09:04:47 +02:00
pre-commit-ci[bot]
2a39ed3461 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 23.1.0 → 23.3.0](https://github.com/psf/black/compare/23.1.0...23.3.0)
2023-04-04 06:34:42 +00:00
Stefanie Molin
f1c7585184 Update fixture scope in package/directory fixture example. 2023-03-31 10:00:45 -07:00
github-actions[bot]
a3b39069bc [automated] Update plugin list (#10838)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-03-26 08:32:13 -03:00
github-actions[bot]
172c832cbd [automated] Update plugin list (#10823)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-03-24 11:41:07 -03:00
dependabot[bot]
839b90db45 build(deps): Bump peter-evans/create-pull-request from 4.2.3 to 4.2.4 (#10828)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.2.3 to 4.2.4.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](2b011faafd...38e0b6e68b)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-24 11:40:34 -03:00
dependabot[bot]
549cc512f7 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#10827)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.20.2 to 0.21.0.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.20.2...v0.21.0)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  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>
2023-03-24 11:40:06 -03:00
Ronny Pfannschmidt
2369bed1db Merge pull request #10727 from RonnyPfannschmidt/ronny/split-report-header
split up report header lines for config, rootdir and testpaths
2023-03-18 22:06:46 +01:00
Ronny Pfannschmidt
54864f0c9b bugfix: fix imports for simple example 2023-03-17 21:58:26 +01:00
Ronny Pfannschmidt
ba969d2ae7 run regendoc 2023-03-17 21:58:26 +01:00
Ronny Pfannschmidt
407b330fe1 split up report header lines
i found it painful to read crammed in a single line
thus rootdir, config file and testpaths now have own lines
2023-03-17 21:58:26 +01:00
Felix Hofstätter
431ec6d34e Correctly handle tracebackhide for chained exceptions (#10772) 2023-03-15 08:10:25 -03:00
pre-commit-ci[bot]
eada68b2b3 [pre-commit.ci] pre-commit autoupdate (#10814)
updates:
- [github.com/PyCQA/autoflake: v2.0.1 → v2.0.2](https://github.com/PyCQA/autoflake/compare/v2.0.1...v2.0.2)
- [github.com/pre-commit/mirrors-mypy: v1.0.1 → v1.1.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.0.1...v1.1.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-03-14 08:17:13 -03:00
dependabot[bot]
ab069247cd build(deps): Bump pytest-rerunfailures in /testing/plugins_integration (#10812)
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 11.1.1 to 11.1.2.
- [Release notes](https://github.com/pytest-dev/pytest-rerunfailures/releases)
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/11.1.1...11.1.2)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-13 08:00:07 -03:00
github-actions[bot]
7af1e4e4ed [automated] Update plugin list (#10810)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-03-12 13:04:50 -03:00
Stefanie Molin
0ae04ae629 Include pyproject.toml in help section that lists out config files with ini-options (#10807) 2023-03-11 10:59:02 -03:00
Florian Bruhin
723035be7f doc: Remove done training (#10805) 2023-03-10 20:47:03 +00:00
Alessio Izzo
6e478b0947 Fix walrus operator support in assertion rewriting (#10758)
Closes #10743
2023-03-10 07:32:36 -03:00
Paul Kehrer
a869141b3d New option to allow a progress report even when capture=no (#10755) 2023-03-07 17:49:37 -03:00
Bruno Oliveira
5e98aefc92 Merge pull request #10794 from pytest-dev/update-plugin-list/patch-d5dda84ef
[automated] Update plugin list
2023-03-06 08:16:06 -03:00
Bruno Oliveira
5f47e423b2 Merge pull request #10795 from bluthej/fix-10782
Fix example in the documentation (#10782)
2023-03-05 13:49:35 -03:00
bluthej
5a61ec3d4a Fix example in the documentation (#10782) 2023-03-05 17:01:21 +01:00
Zac Hatfield-Dodds
b3b44ea814 Merge pull request #10766 from rdb/fix-10765 2023-03-04 23:34:35 -08:00
pytest bot
1d48b3021d [automated] Update plugin list 2023-03-05 00:25:29 +00:00
Bruno Oliveira
d5dda84ef3 Merge pull request #10793 from nicoddemus/cherry-pick-release
Merge pull request #10792 from pytest-dev/release-7.2.2
2023-03-03 16:22:47 -03:00
Bruno Oliveira
517e02e59e Merge pull request #10792 from pytest-dev/release-7.2.2
Prepare release 7.2.2

(cherry picked from commit 3ce6030f0c)
2023-03-03 16:14:11 -03:00
Bruno Oliveira
4e259590c9 Normalize how changelog entries are written (#10779)
Went over all changelog entries making sure they follow our guidelines as written at:

88c9e92258/.github/PULL_REQUEST_TEMPLATE.md (L18-L21)
2023-03-03 12:53:38 -03:00
Bruno Oliveira
97a2761d72 Fix test_cmdline_python_namespace_package (#10788)
pgk_resources.declare_namespace has been deprecated, so added an ignore warnings option
to the test.
2023-03-03 12:25:33 -03:00
Billy
88c9e92258 Minor updates to fixtures docs (#10724)
Updated the c fixture to be a little more consistent with other fixtures in the corresponding image. for example both e and g both have edges connected with the fixtures that they explicitly depend on.
2023-02-28 12:42:33 -03:00
Ronny Pfannschmidt
72ad32411f Docs: be more explicit about module level skip preventing collection (#10753) 2023-02-28 12:41:31 -03:00
Bruno Oliveira
cb9e8be301 Move logic to get_user_id in compat 2023-02-28 11:19:34 -03:00
Bruno Oliveira
d72da480c4 Apply suggestions from code review 2023-02-28 11:02:17 -03:00
Bruno Oliveira
07e7deb4a7 Update changelog/10765.bugfix.rst 2023-02-28 10:59:23 -03:00
Bruno Oliveira
572b5657d7 Merge pull request #10767 from alexhad6/fix-typo-in-python_api.py
Fix typo in python_api.py
2023-02-27 08:59:13 -03:00
dependabot[bot]
44afed9b13 build(deps): Bump pytest-rerunfailures in /testing/plugins_integration (#10754)
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 11.1 to 11.1.1.
- [Release notes](https://github.com/pytest-dev/pytest-rerunfailures/releases)
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/11.1...11.1.1)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-27 08:56:25 -03:00
github-actions[bot]
13ea4780b8 [automated] Update plugin list (#10752)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-02-27 08:55:33 -03:00
Alex Hadley
135600fca3 Fix typo in python_api.py 2023-02-24 15:04:42 -08:00
rdb
c237297b3d Fix OSError in tmpdir on emscripten due to missing getuid()
Fixes #10765
2023-02-24 23:23:44 +01:00
Ronny Pfannschmidt
9ccae9a8e3 Merge pull request #10756 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-02-22 15:10:09 +01:00
pre-commit-ci[bot]
77152d26e7 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.0.0 → v1.0.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.0.0...v1.0.1)
2023-02-21 03:03:45 +00:00
Manuel Jacob
da626e7186 Update import mode documentation to not refer to __import__() anymore. (#10747)
Nowadays, the prepend and append import modes use importlib.import_module() instead of __import__().

There was a phrase “which avoids having to use `__import__`”, in which I couldn’t just replace `__import__` by `importlib.import_module` because the latter is used (in insert_missing_modules()) also when using importlib mode. Therefore I removed the part from the sentence.
2023-02-18 18:55:46 -03:00
bitzge
051f8f1f0f Add CI and BUILD_NUMBER env var in docs (#10749) 2023-02-18 18:52:14 -03:00
Bruno Oliveira
31ad577325 Merge pull request #10741 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.1.7
build(deps): Bump django from 4.1.6 to 4.1.7 in /testing/plugins_integration
2023-02-16 06:50:38 -03:00
dependabot[bot]
835cac8d8b build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.1.6 to 4.1.7.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.1.6...4.1.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-15 20:40:12 +00:00
Florian Bruhin
464f29901f Update open training (#10739) 2023-02-15 14:06:24 +00:00
Garvit Shubham
aa72496d24 Fix entry-points declaration in the documentation example using Hatch
Closes #10721
2023-02-14 10:57:32 -03:00
pre-commit-ci[bot]
e9f3a01392 [pre-commit.ci] pre-commit autoupdate (#10733)
updates:
- [github.com/pre-commit/mirrors-mypy: v0.991 → v1.0.0](https://github.com/pre-commit/mirrors-mypy/compare/v0.991...v1.0.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-02-14 07:30:12 -03:00
dependabot[bot]
00c94ab01b build(deps): Bump pytest-rerunfailures in /testing/plugins_integration (#10731)
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 11.0 to 11.1.
- [Release notes](https://github.com/pytest-dev/pytest-rerunfailures/releases)
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/11.0...11.1)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  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>
2023-02-13 08:05:47 -03:00
github-actions[bot]
9048621002 [automated] Update plugin list (#10726)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-02-12 21:39:45 -03:00
Bruno Oliveira
27165cf8db Use build-and-inspect-python-package action (#10722)
This uses https://github.com/hynek/build-and-inspect-python-package to ensure our package is correct, both during testing and deploy,
2023-02-12 21:37:40 -03:00
Ilya Konstantinov
7a829cb57d Document the location tuple (#10700) 2023-02-12 11:20:53 -03:00
HTRafal
5e1c3d2477 Propagate timestamps from CallInfo to TestReport objects (#10711)
This makes it possible to correlate pytest stages with external events, and also makes it readable when TestReports are exported externall (for example with pytest-reportlog).

Closes #10710
2023-02-10 17:52:54 -03:00
pre-commit-ci[bot]
59e7d2bbc9 [pre-commit.ci] pre-commit autoupdate (#10712)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.12.0 → 23.1.0](https://github.com/psf/black/compare/22.12.0...23.1.0)
- [github.com/PyCQA/autoflake: v2.0.0 → v2.0.1](https://github.com/PyCQA/autoflake/compare/v2.0.0...v2.0.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update .pre-commit-config.yaml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-02-07 19:30:33 -03:00
Mahesh Vashishtha
af99040123 Add a note about -W vs filterwarnings. (#10713)
Closes #10687

Signed-off-by: mvashishtha <mahesh@ponder.io>
2023-02-07 19:27:34 -03:00
dependabot[bot]
a2b7db7655 build(deps): Bump django in /testing/plugins_integration (#10706)
Bumps [django](https://github.com/django/django) from 4.1.5 to 4.1.6.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.1.5...4.1.6)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-07 08:00:16 -03:00
github-actions[bot]
9c93c96b14 [automated] Update plugin list (#10707)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-02-07 07:59:57 -03:00
github-actions[bot]
4a46ee8bc9 [automated] Update plugin list (#10699)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2023-01-30 10:15:02 -03:00
Teejay
5dbfb8e108 Fix fixtures named teardown being considered by nose (#10696)
Closes #10597
2023-01-27 14:33:46 -03:00
vin01
86a1beba07 Clarify docs for match regarding escaping (#10695)
Add example using `re.escape` to escape arbitrary literal strings which might contain regular expression characters like `.` or `)`.

Closes #10595
2023-01-27 08:11:00 -03:00
Jay
ca40380e99 Add check for zero denominator in approx (#10624)
Closes #10533
2023-01-24 07:07:42 -03:00
Bruno Oliveira
05eee78aaa Merge pull request #10599 from pytest-dev/fix-update-plugin-list-workflow
Fix update-plugin-list workflow due to new 'packaging'
2023-01-23 17:55:45 -03:00
Ran Benita
02893139f9 Merge pull request #10680 from bluetech/capture-typing
capture: improve typing
2023-01-23 14:38:28 +02:00
Ran Benita
8c53dbf9d7 capture: fix pyright type error
This is OK in mypy, but doesn't hurt to fix.
2023-01-23 14:12:01 +02:00
Ran Benita
54b8b40f83 capture: improve NoCapture typing 2023-01-23 14:12:01 +02:00
Ran Benita
54911acf8d capture: improve captureclass typing
Previously, the any `captureclass` arguments were Any. We need to
introduce another common base class to fix this.
2023-01-23 14:12:01 +02:00
Ran Benita
c746d2b016 capture: improve SysCapture/FDCapture typing
Instead of `SysCapture`/`FDCapture` inheriting from
`SysCaptureBinary`/`FDCaptureBinary`, have both inherit from a common
`SysCaptureBase`/`FDCaptureBase`. This fixes a Liskov substitution
violation.
2023-01-23 14:12:01 +02:00
Ran Benita
a3693ce503 capture: improve DontReadFromInput typing
Have `DontReadFromInput` inherit from `TextIO`, ensuring it's fully
compatible with `sys.stdin` (which has type `TextIO`).
2023-01-23 14:12:01 +02:00
Yannick PÉROUX
af4143729f Allow spaces in -p arguments (#10658) 2023-01-21 08:22:44 -03:00
q0w
bd7919e03d Initialize args and args_source during Config.__init__
Closes #10626

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-01-21 08:19:54 -03:00
Ran Benita
7d4b40337b capture: fix some Anys 2023-01-21 10:39:58 +02:00
Ran Benita
6a714d7b70 capture: CaptureResult can be a namedtuple again (#10678)
mypy now supports generic NamedTuple.
2023-01-21 09:39:58 +02:00
Ran Benita
5a23eeff7a Merge pull request #10668 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-rerunfailures-11.0
build(deps): Bump pytest-rerunfailures from 10.3 to 11.0 in /testing/plugins_integration
2023-01-20 11:23:54 +02:00
Ran Benita
310b67b227 Drop attrs dependency, use dataclasses instead (#10669)
Since pytest now requires Python>=3.7, we can use the stdlib attrs
clone, dataclasses, instead of the OG package.

attrs is still somewhat nicer than dataclasses and has some extra
functionality, but for pytest usage there's not really a justification
IMO to impose the extra dependency on users when a standard alternative
exists.
2023-01-20 11:13:36 +02:00
Ramsey
4d4ed42c34 Fix crash if --cache-show and --help are passed at the same time
Closes #10592
2023-01-19 09:44:57 -03:00
Ronny Pfannschmidt
096b942ec4 Merge pull request #10660 from ikonst/2023-01-13-raises-typing
Derive pytest.raises from AbstractContextManager
2023-01-18 06:42:46 +01:00
pre-commit-ci[bot]
61cfaacec6 [pre-commit.ci] pre-commit autoupdate (#10671)
updates:
- [github.com/asottile/blacken-docs: v1.12.1 → 1.13.0](https://github.com/asottile/blacken-docs/compare/v1.12.1...1.13.0)
- [github.com/pre-commit/pygrep-hooks: v1.9.0 → v1.10.0](https://github.com/pre-commit/pygrep-hooks/compare/v1.9.0...v1.10.0)
2023-01-17 12:09:19 +02:00
dependabot[bot]
95c62eb527 build(deps): Bump pytest-rerunfailures in /testing/plugins_integration
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 10.3 to 11.0.
- [Release notes](https://github.com/pytest-dev/pytest-rerunfailures/releases)
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/10.3...11.0)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-16 03:00:46 +00:00
Bruno Oliveira
03b19945fb Merge pull request #10662 from nicoddemus/cherry-pick-release
Merge pull request #10659 from pytest-dev/release-7.2.1
2023-01-14 09:35:02 -03:00
Bruno Oliveira
b2ac31cc9f Merge pull request #10659 from pytest-dev/release-7.2.1
Prepare release 7.2.1

(cherry picked from commit 94c05bc2a4)
2023-01-14 09:21:43 -03:00
Ilya Konstantinov
1a96f16401 Derive pytest.raises from AbstractContextManager
Makes `AbstractContextManager` the shared base class between "raises" and other context managers.

The motivation is for type checkers to narrow `pytest.raises(...) if x else nullcontext()` to a `ContextManager` rather than `object`.
2023-01-13 13:58:49 -05:00
dependabot[bot]
7421f3bb94 build(deps): Bump django in /testing/plugins_integration (#10643)
Bumps [django](https://github.com/django/django) from 4.1.3 to 4.1.5.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.1.3...4.1.5)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-13 07:16:43 -03:00
Bruno Oliveira
5e0583f4b9 Fix regen tox environment (#10640)
Since tox 4.0, the whitelist_external option has been renamed to allowlist_externals.

Co-authored-by: pytest bot <pytestbot@gmail.com>
2023-01-13 07:15:41 -03:00
s-padmanaban
8efb4bb9c1 Do not update cache from xdist worker (#10641) 2023-01-13 07:14:52 -03:00
Kadino
3ad4344656 Mitigate directory creation race condition (#10607)
Fixes https://github.com/pytest-dev/pytest/issues/10604 which could intermittently display unexpected behavior between checking if the path exists and requesting creation. This was fairly prevalent when pytest was being invoked in parallel by another test runner (CTest) and trying to create the same parent-folder for multiple XMLs. A modest amount of testing did not reproduce other filesystem race conditions.

This notably does not work around an edge case where the parent path of the XML could be created as a file instead of a folder or link. That vanishingly rare case should cause file creation to fail on the next line, with a fairly obvious exception message.
2023-01-06 09:12:24 -03:00
Bruno Oliveira
6bf7f55555 Merge pull request #10632 from danigm/fix-tests
Fix tests pygments 2.14.0
2023-01-05 12:59:24 -03:00
Daniel Garcia Moreno
61f70a5a75 Fix tests pygments 2.14.0
Fix https://github.com/pytest-dev/pytest/issues/10630
2023-01-04 10:30:28 +01:00
Bruno Oliveira
326ae0cd88 Merge pull request #10609 from yusuke-kadowaki/default_policy_all
Change the default `tmp_path_retention_policy` to `all`
2022-12-25 14:09:45 -03:00
Yusuke Kadowaki
10220d3f31 Change the default policy to all 2022-12-25 00:18:38 +09:00
Bruno Oliveira
a98b00cd09 Use a more descriptive job name for update-plugin-list workflow 2022-12-21 14:01:37 -03:00
Bruno Oliveira
215ea7fd03 Fix update-plugin-list workflow due to new 'packaging'
The latest 'packaging' release has dropped support for `LegacyVersion`, meaning
that version strings which do not conform to the standard now raise an error.
2022-12-21 14:01:37 -03:00
Pierre Sassoulas
b31db4809b Avoid truncation when truncating means longer output (#10446)
Fixes #6267
2022-12-17 10:24:46 -03:00
Bruno Oliveira
f6adebb990 Fix tox 4.0 support and docs
Also includes pre-commit autoupdate
2022-12-14 08:57:07 -03:00
Bruno Oliveira
b90e7b84d0 Remove reference to explicit pytest tox support
This reference no longer exists in tox 4.0 docs.
2022-12-14 08:38:11 -03:00
Bruno Oliveira
19807ab79a Pin packaging while building docs
Packaging >=22 no longer supports 'latest' versions, which is the version that is assigned when building the docs.

https://github.com/pytest-dev/pytest/pull/10578#issuecomment-1348249045

Also first install pytest, then `docs/en/requirements.txt`:

Installing the requirements last will honor pins of libraries
shared between pytest and the docs build.
2022-12-14 08:38:11 -03:00
Bruno Oliveira
3e52124185 Fix passenv setting for tox.ini
In tox 4.0 `passenv` is required to be one per-line, or comma-separated.
2022-12-14 08:35:39 -03:00
pre-commit-ci[bot]
1eca228bd5 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 22.10.0 → 22.12.0](https://github.com/psf/black/compare/22.10.0...22.12.0)
- [github.com/asottile/pyupgrade: v3.3.0 → v3.3.1](https://github.com/asottile/pyupgrade/compare/v3.3.0...v3.3.1)
2022-12-13 01:28:21 +00:00
Bruno Oliveira
cab02e67d7 Merge pull request #10559 from pytest-dev/update-plugin-list/patch-9fbd67dd4
[automated] Update plugin list
2022-12-06 11:17:45 -03:00
Bruno Oliveira
64dbc7a0a1 Merge pull request #10560 from pytest-dev/dependabot/github_actions/peter-evans/create-pull-request-4.2.3
build(deps): Bump peter-evans/create-pull-request from 3.7.0 to 4.2.3
2022-12-06 11:16:54 -03:00
Bruno Oliveira
60d992677d Merge pull request #10563 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-12-06 11:06:16 -03:00
pre-commit-ci[bot]
0079decf29 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.2.2 → v3.3.0](https://github.com/asottile/pyupgrade/compare/v3.2.2...v3.3.0)
2022-12-06 00:36:28 +00:00
dependabot[bot]
3a58fc2d44 build(deps): Bump peter-evans/create-pull-request from 3.7.0 to 4.2.3
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3.7.0 to 4.2.3.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](2455e15969...2b011faafd)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 03:15:13 +00:00
pytest bot
39b6bb551c [automated] Update plugin list 2022-12-04 00:20:05 +00:00
Marko Pacak
9fbd67dd4b Class methods can now be discovered as tests (#10552)
Fix #10525
2022-12-02 15:53:04 +00:00
Zac Hatfield-Dodds
eca93db05b Merge pull request #10550 from danschef/use_os_sep
Use os.sep instead of os.path.sep.
2022-12-02 00:32:12 -08:00
Daniel Scheffler
fb701b538c Use os.sep instead of os.path.sep.
Signed-off-by: Daniel Scheffler <danschef@gfz-potsdam.de>
2022-12-01 18:16:02 +01:00
Bruno Oliveira
314e623304 Merge pull request #10549 from yusuke-kadowaki/more_doc_update
Documentation update for the tmp_path configurations
2022-12-01 12:23:43 -03:00
Yusuke Kadowaki
62e75c7d55 Documentation update for tmp_path configurations 2022-12-01 22:29:46 +09:00
github-actions[bot]
fd30759d94 [automated] Update plugin list (#10536)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-11-29 09:14:38 +00:00
dependabot[bot]
eb984a717a build(deps): Bump pytest-rerunfailures in /testing/plugins_integration (#10537)
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 10.2 to 10.3.
- [Release notes](https://github.com/pytest-dev/pytest-rerunfailures/releases)
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/10.2...10.3)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-29 09:55:24 +01:00
Anthony Sottile
54f0fb3c63 Merge pull request #10543 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-11-28 20:27:39 -08:00
pre-commit-ci[bot]
49a4ed14cf [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0)
- [github.com/PyCQA/autoflake: v1.7.7 → v2.0.0](https://github.com/PyCQA/autoflake/compare/v1.7.7...v2.0.0)
- [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](https://github.com/PyCQA/flake8/compare/5.0.4...6.0.0)
2022-11-29 02:01:34 +00:00
Yusuke Kadowaki
f513d33d5a Modify documentation to use .stash when storing test results. (#10535) 2022-11-27 22:09:56 +02:00
Prerak Patel
857e34ef85 Fix bug where file system root was erroneously be used as rootdir on Windows
Fix #10506
2022-11-23 14:46:00 -03:00
Yusuke Kadowaki
99dfc19fe6 Fix tmp_path_retention_policy crash when skipping from fixture (#10517)
Also uses the stash to save the test status.

Fix #10502
2022-11-23 10:48:29 -03:00
pre-commit-ci[bot]
56544c11b5 [pre-commit.ci] pre-commit autoupdate (#10522)
updates:
- [github.com/pre-commit/mirrors-mypy: v0.990 → v0.991](https://github.com/pre-commit/mirrors-mypy/compare/v0.990...v0.991)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-22 08:27:55 -03:00
github-actions[bot]
7710e18b4c [automated] Update plugin list (#10519)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-11-22 08:05:40 -03:00
Daniel Valenzuela
791b51d0fa Show test name when skipping from fixture (#10482)
Fixes #10457
2022-11-18 09:20:38 -03:00
Anthony Sottile
bc4e70e048 Merge pull request #10504 from pytest-dev/all-repos_autofix_no-implicit-optional
remove no_implicit_optional
2022-11-17 00:30:51 -05:00
Anthony Sottile
b817aa457c remove no_implicit_optional
this is the default in mypy 0.990

Committed via https://github.com/asottile/all-repos
2022-11-16 19:20:16 -05:00
Anthony Sottile
66b28912ac Merge pull request #10497 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-11-16 13:18:59 -05:00
Yusuke Kadowaki
cca029d55e Add configuration options to control how tmp_path directories are kept (#10442)
Close #8141
2022-11-15 09:11:39 -03:00
Bruno Oliveira
d5466b3917 Fix typing errors after mypy update 2022-11-15 08:53:23 -03:00
pre-commit-ci[bot]
4fce29f15d [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.2.0 → v3.2.2](https://github.com/asottile/pyupgrade/compare/v3.2.0...v3.2.2)
- [github.com/pre-commit/mirrors-mypy: v0.982 → v0.990](https://github.com/pre-commit/mirrors-mypy/compare/v0.982...v0.990)
2022-11-15 00:17:06 +00:00
Bruno Oliveira
69e3973d86 Merge pull request #10468 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.1.3
build(deps): Bump django from 4.1.2 to 4.1.3 in /testing/plugins_integration
2022-11-14 09:25:28 -03:00
dependabot[bot]
c842893b02 build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.1.2...4.1.3)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-14 11:36:55 +00:00
dependabot[bot]
506b10d295 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#10494)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.20.1 to 0.20.2.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.20.1...v0.20.2)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-11-14 11:36:00 +00:00
Bruno Oliveira
05061493cb Merge pull request #10495 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-bdd-6.1.1
build(deps): Bump pytest-bdd from 6.0.1 to 6.1.1 in /testing/plugins_integration
2022-11-14 08:09:07 -03:00
dependabot[bot]
f97f3dc3a3 build(deps): Bump pytest-bdd in /testing/plugins_integration
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 6.0.1 to 6.1.1.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/6.0.1...6.1.1)

---
updated-dependencies:
- dependency-name: pytest-bdd
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-14 03:00:43 +00:00
Bruno Oliveira
3c31b0132f Merge pull request #10493 from pytest-dev/update-plugin-list/patch-54d5a63d1
[automated] Update plugin list
2022-11-13 12:02:36 -03:00
pytest bot
593178d909 [automated] Update plugin list 2022-11-13 00:22:21 +00:00
Bruno Oliveira
54d5a63d14 Merge pull request #10488 from DanielVZ96/fix-test-raising-repr
Fix test_raising_repr test
2022-11-09 20:20:05 -03:00
Daniel Valenzuela
b55e264a67 Fix test_raising_repr test
Closes #10473

Python <3.11 versions depend on `exceptiongroup>=1.0.0rc8`, and they released version `1.0.1`
6 days ago (2022/11/03) that as a side-effect changed the output of exceptions.
2022-11-09 19:43:10 -03:00
Bruno Oliveira
13d6114c0a Merge pull request #10484 from joukewitteveen/patch-2
scripts/update-plugin-list: Improve requirement detection
2022-11-09 10:07:12 -03:00
Jouke Witteveen
b635e16d30 scripts/update-plugin-list: Improve requirement detection
PEP 566 does not require a space after the dependency name.
2022-11-08 19:05:10 +01:00
Bruno Oliveira
a092b3ab36 Merge pull request #10481 from pytest-dev/update-plugin-list/patch-aa7e9de91
[automated] Update plugin list
2022-11-08 09:07:00 -03:00
pytest bot
a006dabf6e [automated] Update plugin list 2022-11-08 11:13:43 +00:00
Bruno Oliveira
aa7e9de91d Merge pull request #10480 from joukewitteveen/patch-1
scripts/update-plugin-list: Be liberal in accepted summaries
2022-11-08 08:11:35 -03:00
Jouke Witteveen
6aec32163d scripts/update-plugin-list: Be liberal in accepted summaries
Misconfigured packages may have a null summary in the PyPI json response.
2022-11-07 21:00:31 +01:00
Florian Bruhin
2f33ea87c8 Remove done trainings (#10471) 2022-11-04 18:38:09 +01:00
Ashish Kurmi
1ada62e237 Update dependabot for GitHub Actions (#10464)
Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>

Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>
2022-11-04 07:41:34 -03:00
pre-commit-ci[bot]
50b232b0cb [pre-commit.ci] pre-commit autoupdate (#10454)
updates:
- [github.com/asottile/reorder_python_imports: v3.8.5 → v3.9.0](https://github.com/asottile/reorder_python_imports/compare/v3.8.5...v3.9.0)
- [github.com/asottile/pyupgrade: v3.1.0 → v3.2.0](https://github.com/asottile/pyupgrade/compare/v3.1.0...v3.2.0)
- [github.com/asottile/setup-cfg-fmt: v2.1.0 → v2.2.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.1.0...v2.2.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-31 21:37:05 -03:00
dependabot[bot]
496196b15c build(deps): Bump pytest-html in /testing/plugins_integration (#10450)
Bumps [pytest-html](https://github.com/pytest-dev/pytest-html) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/pytest-dev/pytest-html/releases)
- [Changelog](https://github.com/pytest-dev/pytest-html/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-html/compare/v3.1.1...v3.2.0)

---
updated-dependencies:
- dependency-name: pytest-html
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-31 12:51:34 -03:00
Hugo van Kemenade
0314b50c52 Fix 'importlib.abc.TraversableResources' deprecation warning in Python 3.12 (#10452) 2022-10-31 12:49:51 -03:00
wim glenn
8e2de91bf8 Merge pull request #10449 from cj81499/patch-1
fix type in python_api.py
2022-10-30 22:26:56 -05:00
Cal Jacobson
692ab1160b add Cal Jacobson to AUTHORS 2022-10-30 22:02:18 -05:00
Cal Jacobson
549839bac5 fix type in python_api.py
excpected -> expected
2022-10-30 21:59:09 -05:00
Florian Bruhin
646a46e5f4 Edit changelog for 7.2.0 (#10423)
Fix some typos, and consolidate two entries for the same feature into one.
2022-10-25 19:47:16 +02:00
Santiago Castro
f07017f91b Add the PyPI classifier for Python 3.11 (#10426) 2022-10-25 13:43:59 -03:00
Anthony Sottile
a17d3b0c44 Merge pull request #10425 from pytest-dev/asottile-patch-1
upgrade pygments-pytest for 7.2.x coloring
2022-10-25 11:27:36 -04:00
Anthony Sottile
bbec1ce67f upgrade pygments-pytest for 7.2.x coloring 2022-10-25 10:52:53 -04:00
Ronny Pfannschmidt
5a040aef97 Merge pull request #10412 from pytest-dev/release-7.2.0 (#10419)
Prepare release 7.2.0

(cherry picked from commit ac4e3cced9)
2022-10-25 13:12:55 +02:00
Bruno Oliveira
c1d2168df6 Merge pull request #10417 from nicoddemus/publish-action-pin
Use specific tag in the gh-action-pypi-publish action
2022-10-25 08:11:33 -03:00
pre-commit-ci[bot]
bbe7cbae4a [pre-commit.ci] pre-commit autoupdate (#10418)
updates:
- [github.com/PyCQA/autoflake: v1.7.6 → v1.7.7](https://github.com/PyCQA/autoflake/compare/v1.7.6...v1.7.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-24 20:25:15 -03:00
Bruno Oliveira
deae8f47f6 Use specific tag in the gh-action-pypi-publish action
Otherwise we see this warning:

Warning:  You are using "pypa/gh-action-pypi-publish@master". The "master" branch of this project has been sunset and will not receive any updates, not even security bug fixes. Please, make sure to use a supported version. If you want to pin to v1 major version, use "pypa/gh-action-pypi-publish@release/v1". If you feel adventurous, you may opt to use use "pypa/gh-action-pypi-publish@unstable/v1" instead. A more general recommendation is to pin to exact tags or commit shas.
2022-10-24 19:23:40 -03:00
Zac Hatfield-Dodds
10f55f79af Merge pull request #10226 from Zac-HD/use-exceptiongroup-for-teardown
Use exceptiongroup for multiple errors during teardown
2022-10-24 08:44:02 -07:00
Bruno Oliveira
a6d244343f Merge pull request #10416 from rettinghaus/update-actions
Update used GitHub Actions to latest versions
2022-10-24 10:32:58 -03:00
Klaus Rettinghaus
2b552c2240 update actions 2022-10-24 14:58:03 +02:00
Bruno Oliveira
54d7b9a08e Merge pull request #10415 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-asyncio-0.20.1
build(deps): Bump pytest-asyncio from 0.19.0 to 0.20.1 in /testing/plugins_integration
2022-10-24 08:12:12 -03:00
Bruno Oliveira
6afc02abca Merge pull request #10414 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.6.2
build(deps): Bump anyio[curio,trio] from 3.6.1 to 3.6.2 in /testing/plugins_integration
2022-10-24 08:11:49 -03:00
dependabot[bot]
e75e2d66a0 build(deps): Bump pytest-asyncio in /testing/plugins_integration
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.19.0 to 0.20.1.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.19.0...v0.20.1)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-24 03:04:18 +00:00
dependabot[bot]
66db0b7522 build(deps): Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.6.1 to 3.6.2.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/3.6.2/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.6.1...3.6.2)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-24 03:04:15 +00:00
Zac Hatfield-Dodds
3a68c08426 Use exceptiongroup for teardown errors 2022-10-23 15:45:50 -07:00
Itxaso Aizpurua
9e1804a6ee Add --log-disable CLI option (#10371)
Fixes #7431
2022-10-23 18:23:34 -03:00
Bruno Oliveira
bc2c3b66aa Merge pull request #10408 from NateMeyvis/patch-2
Fix typos in CONTRIBUTING.rst
2022-10-22 10:01:04 -03:00
Bruno Oliveira
d84ed48f39 Merge pull request #10409 from pytest-dev/asottile-patch-1
allow jobs to pass if codecov.io fails
2022-10-22 10:00:32 -03:00
Anthony Sottile
ffe49ac17c Merge pull request #10396 from pytest-dev/pylib-hax
vendor py.path and py.error
2022-10-21 13:37:32 -04:00
Anthony Sottile
d352098261 allow jobs to pass if codecov.io fails 2022-10-21 13:11:43 -04:00
Nate Meyvis
c5c562b645 Fix typos in CONTRIBUTING.rst
Fix small grammatical issues in CONTRIBUTING.rst to improve readability.
2022-10-21 13:06:44 -04:00
Anthony Sottile
d543a45a68 add deprecation changelog for py library vendoring 2022-10-21 12:46:15 -04:00
Bruno Oliveira
f341a5c559 Merge pull request #10407 from NateMeyvis/patch-1
Add note on tags to CONTRIBUTING.rst
2022-10-21 13:11:36 -03:00
pre-commit-ci[bot]
1027dc8c09 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-21 15:18:44 +00:00
Nate Meyvis
6b905ee6dc Add note on tags to CONTRIBUTING.rst
Tags from the main repository are required for testing to work properly, but the current documentation does not reflect this, and at least one new contributor has been tripped up by this. Update the documentation with a short explanation and directions.
2022-10-21 11:17:01 -04:00
Anthony Sottile
508be0b2bf add -pylib tox environment 2022-10-20 17:15:57 -04:00
Anthony Sottile
02a9371259 adjust tests if py library is installed 2022-10-19 22:28:51 -04:00
Anthony Sottile
dc0cb0d149 fix test pollution of sys.modules 2022-10-19 22:18:50 -04:00
Anthony Sottile
82344ba4f8 add py.path.local tests 2022-10-19 21:42:40 -04:00
Anthony Sottile
59d8f8a223 _pytest._py.path: get mypy passing 2022-10-19 21:42:40 -04:00
Anthony Sottile
ed4c18f686 _pytest._py.path: combine PathBase and LocalPath 2022-10-19 21:42:40 -04:00
Anthony Sottile
6660d45521 _pytest._py.path: combine PosixPath into LocalPath 2022-10-19 21:42:40 -04:00
Anthony Sottile
af078f3a96 _pytest._py.path: combine Checkers classes 2022-10-19 21:42:40 -04:00
Anthony Sottile
73349ef3e1 _pytest._py.path: flake8 fixes 2022-10-19 21:42:40 -04:00
Anthony Sottile
63c4d45c59 _pytest._py.path: importlib mode always available 2022-10-19 21:42:40 -04:00
Anthony Sottile
eebbfc65c9 _pytest._py.error: mypy typing 2022-10-19 21:42:40 -04:00
Anthony Sottile
382209d9e9 _pytest._py.path: remove decorator compat 2022-10-19 16:52:26 -04:00
Anthony Sottile
00e2f1c15c _pytest._py.path: remove _cmp compat 2022-10-19 16:52:26 -04:00
Anthony Sottile
8a151774b8 _pytest._py.path: remove fspath compat 2022-10-19 16:52:26 -04:00
Anthony Sottile
a7c1fc204b remove other py.* accesses in _pytest._py.path 2022-10-19 16:52:26 -04:00
Anthony Sottile
965e942dfb use getrawcode from _pytest._code 2022-10-19 16:52:26 -04:00
Anthony Sottile
349f4bffa0 use module __getattr__ for py.error to fix doctesting 2022-10-19 16:52:26 -04:00
pre-commit-ci[bot]
49abbf2485 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-19 16:52:26 -04:00
Anthony Sottile
19dda7c9bd vendor py.path and py.error 2022-10-19 16:52:26 -04:00
Bruno Oliveira
baada535a3 Merge pull request #10389 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-10-18 07:46:47 -03:00
pre-commit-ci[bot]
c477ecd146 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/autoflake: v1.7.3 → v1.7.6](https://github.com/PyCQA/autoflake/compare/v1.7.3...v1.7.6)
- [github.com/asottile/reorder_python_imports: v3.8.4 → v3.8.5](https://github.com/asottile/reorder_python_imports/compare/v3.8.4...v3.8.5)
- [github.com/asottile/setup-cfg-fmt: v2.0.0 → v2.1.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.0.0...v2.1.0)
2022-10-17 23:48:17 +00:00
Bruno Oliveira
36d19f2135 Merge pull request #10388 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-twisted-1.14.0
build(deps): Bump pytest-twisted from 1.13.4 to 1.14.0 in /testing/plugins_integration
2022-10-17 11:04:12 -03:00
dependabot[bot]
8490ff5277 build(deps): Bump pytest-twisted in /testing/plugins_integration
Bumps [pytest-twisted](https://github.com/pytest-dev/pytest-twisted) from 1.13.4 to 1.14.0.
- [Release notes](https://github.com/pytest-dev/pytest-twisted/releases)
- [Commits](https://github.com/pytest-dev/pytest-twisted/compare/v1.13.4...v1.14.0)

---
updated-dependencies:
- dependency-name: pytest-twisted
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-17 03:02:02 +00:00
Zac Hatfield-Dodds
3dac833a52 Merge pull request #10383 from gabriellandau/dont-pdb-break-for-skiptest-exceptions 2022-10-15 11:14:26 -07:00
Zac Hatfield-Dodds
36b6384ff2 Merge pull request #10384 from tony/showlocals-negation 2022-10-15 10:43:59 -07:00
Ronny Pfannschmidt
31df38f6a7 Merge pull request #10356 from RonnyPfannschmidt/fix-7792-marks-walk-mro
fix #7792: consider marks from the mro
2022-10-15 17:19:27 +02:00
Tony Narlock
2a33e6ab61 docs: Update changelog for --no-show-locals 2022-10-14 17:20:36 -05:00
Tony Narlock
7fada7127e docs(output): Note --no-show-locals 2022-10-14 16:38:14 -05:00
Tony Narlock
3a8d401ac7 test(--no-showlocals): Should hide locals when addopts=--showlocals 2022-10-14 16:25:15 -05:00
Tony Narlock
2b6622fdd3 🔧 Negating --showlocals with --no-showlocals
This is necessary for addopts=--showlocals where individual test runs
need to not show locals.
2022-10-14 16:19:07 -05:00
Gabriel Landau
0bc9ffcc87 Add Gabriel Landau to AUTHORS 2022-10-14 14:01:20 -04:00
Gabriel Landau
f3d7e984ab Changelog 2022-10-14 13:58:59 -04:00
Gabriel Landau
452617686c Test fix 2022-10-14 13:53:06 -04:00
Gabriel Landau
6e7917c1a0 Don't break into pdb for raise unittest.SkipTest() 2022-10-13 18:20:46 -04:00
Bruno Oliveira
15ac0349b2 Merge pull request #10373 from ofek/patch-1
Fix packaging example
2022-10-12 22:19:41 -03:00
Ofek Lev
86602ce6e0 Fix packaging example 2022-10-12 11:51:26 -04:00
pre-commit-ci[bot]
c543e0c4e8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-12 08:21:17 +00:00
Ronny Pfannschmidt
f13f4360d3 Apply suggestions from code review
Co-authored-by: Ran Benita <ran@unusedvar.com>
2022-10-12 10:20:16 +02:00
Bruno Oliveira
b7d4de1ea9 Merge pull request #10368 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-10-11 08:17:05 -03:00
Bruno Oliveira
a9c66172d4 Update to autoflake to 1.7.3
Fixes PyCQA/autoflake#168
2022-10-11 08:11:15 -03:00
pre-commit-ci[bot]
3de63f9a9b [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 22.8.0 → 22.10.0](https://github.com/psf/black/compare/22.8.0...22.10.0)
- [github.com/PyCQA/autoflake: v1.6.1 → v1.7.2](https://github.com/PyCQA/autoflake/compare/v1.6.1...v1.7.2)
- [github.com/asottile/reorder_python_imports: v3.8.3 → v3.8.4](https://github.com/asottile/reorder_python_imports/compare/v3.8.3...v3.8.4)
- [github.com/asottile/pyupgrade: v2.38.2 → v3.1.0](https://github.com/asottile/pyupgrade/compare/v2.38.2...v3.1.0)
- [github.com/pre-commit/mirrors-mypy: v0.981 → v0.982](https://github.com/pre-commit/mirrors-mypy/compare/v0.981...v0.982)
2022-10-11 00:32:50 +00:00
Thomas Grainger
246ceb84bd Update doc/en/deprecations.rst 2022-10-10 13:58:05 +01:00
Thomas Grainger
2fd160110c Merge branch 'main' into warn-when-a-mark-is-applied-to-a-fixture 2022-10-10 13:55:24 +01:00
Thomas Grainger
2998b596b4 Merge remote-tracking branch 'graingert/warn-when-a-mark-is-applied-to-a-fixture' into warn-when-a-mark-is-applied-to-a-fixture 2022-10-10 13:53:51 +01:00
Thomas Grainger
7f73722c4a add a test for fixture between mark decorators 2022-10-10 13:52:26 +01:00
Thomas Grainger
f7542f6292 move tests into deprecated_test, and test for number of warnings issued 2022-10-10 13:48:26 +01:00
pre-commit-ci[bot]
0de2aa93f0 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-10 11:30:13 +00:00
Thomas Grainger
7759a9d3c2 Update src/_pytest/deprecated.py
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-10-10 12:28:30 +01:00
Thomas Grainger
d86df89a92 Update doc/en/deprecations.rst
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-10-10 12:28:22 +01:00
Thomas Grainger
24fd292878 Update changelog/3664.deprecation.rst
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-10-10 12:28:14 +01:00
Bruno Oliveira
f5797abb62 Merge pull request #10361 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.10.0
build(deps): Bump pytest-mock from 3.9.0 to 3.10.0 in /testing/plugins_integration
2022-10-10 08:03:35 -03:00
Bruno Oliveira
b735f9377a Merge pull request #10360 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.1.2
build(deps): Bump django from 4.1.1 to 4.1.2 in /testing/plugins_integration
2022-10-10 08:03:24 -03:00
dependabot[bot]
d8c5e8805f build(deps): Bump pytest-mock in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.9.0 to 3.10.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.9.0...v3.10.0)

---
updated-dependencies:
- dependency-name: pytest-mock
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 03:03:48 +00:00
dependabot[bot]
07b380bb3a build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.1.1...4.1.2)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 03:03:45 +00:00
itxasos23
78c2c48c67 Handle NFC/NFD strings that normalize to the same string. (#10355)
Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
2022-10-09 17:09:33 -07:00
Thomas Grainger
8a40fc5315 PytestReturnNotNoneWarning now subclasses PytestRemovedIn8Warning (#10196)
As discussed in https://github.com/pytest-dev/pytest/pull/9956#issuecomment-1132710934.

Also added PytestRemovedIn8Warning to the reference docs.
2022-10-09 20:10:45 -03:00
Vivaan Verma
196f01965e Replace entrypoint example with pyproject.toml in docs (#10359)
Fixes #10344
2022-10-09 17:42:42 -03:00
Simon K
3bf2bc55b1 Add deprecations for tests written for nose (#9907)
Fixes #9886
2022-10-09 17:16:33 -03:00
Thomas Grainger
a1b10b552a use getfixturemarker 2022-10-09 20:25:48 +01:00
pre-commit-ci[bot]
aa9cc7e8b4 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-09 19:11:57 +00:00
Thomas Grainger
5c286d19d8 Update doc/en/deprecations.rst 2022-10-09 20:11:51 +01:00
Thomas Grainger
faac197fcf Merge branch 'main' into warn-when-a-mark-is-applied-to-a-fixture 2022-10-09 20:10:53 +01:00
Bruno Oliveira
571dc6b220 Merge pull request #10358 from drakulavich/patch-1 2022-10-09 10:07:17 -03:00
Anton Yakutovich
d0abfb1c2a Bump actions in test.yml 2022-10-09 16:27:35 +04:00
Ran Benita
81113c1a90 Merge pull request #10354 from pytest-dev/revert-10346-ci-pat
Revert "ci: fix PR not triggering workflows by switching back to pytestbot access token"
2022-10-08 16:31:26 +03:00
Bruno Oliveira
784ba85b17 Merge pull request #10331 from sgaist/add_modernization_tip_for_tmpdir_and_tmpdir_factory 2022-10-08 09:54:21 -03:00
Samuel Gaist
a28d595b46 doc: add note to help modernize code bases to use pathlib
Fixes #10199
2022-10-08 10:18:08 +02:00
Ronny Pfannschmidt
c42bb36009 fixup: mark mro test reformatt 2022-10-08 08:35:53 +02:00
Ronny Pfannschmidt
13e594a314 fixup: mark mro test reformatt 2022-10-08 08:35:26 +02:00
Ronny Pfannschmidt
4e7486d3fb fixup: annotations 2022-10-08 08:28:03 +02:00
Ronny Pfannschmidt
d8c783268c fix #7792: consider marks from the mro
closes #9105 as superseeded
2022-10-08 08:18:26 +02:00
Bruno Oliveira
3c1534944c Merge pull request #10318 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-10-07 20:04:48 -03:00
Ran Benita
a501518a26 Revert "ci: fix PR not triggering workflows by switching back to pytestbot access token" 2022-10-08 00:58:51 +03:00
Ran Benita
680f3e2097 Merge pull request #10327 from AA-Turner/devnul
Use an explicit encoding when opening `os.devnul`
2022-10-08 00:52:11 +03:00
Ran Benita
ed5d4e1269 Merge pull request #10346 from bluetech/ci-pat
ci: fix PR not triggering workflows by switching back to pytestbot access token
2022-10-08 00:30:34 +03:00
Tony Narlock
8e7ce60c7d Export pytest.DoctestItem for typing / runtime purposes (#10313)
Fixes #10312
2022-10-07 13:03:42 -03:00
wodny
2bc036e50a Mention pythonpath confval in Good Integration Practices (#10314)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-07 13:03:13 -03:00
Bruno Oliveira
79c2e92bb8 Merge pull request #10349 from nicoddemus/doc-setup-teardown-nose 2022-10-07 11:48:09 -03:00
Bruno Oliveira
4da0689653 Ignore mypy error about missing generic arg for catch_warnings
mypy stubs recently changed warnings.catch_warnings to a Generic, in
order to have proper overloads depending on the parameters passed to it, whihc
triggers this mypy error now when we subclass it:

    src/_pytest/recwarn.py:170: error: Missing type parameters for generic type "catch_warnings"  [type-arg]

For our porpuses the parameter is not relevant (we always use record=True), so
decided to just ignore the type error.
2022-10-07 11:30:24 -03:00
Florian Bruhin
9be1e3fac8 doc: Add second day for enterPy training (#10348) 2022-10-07 16:13:05 +02:00
Bruno Oliveira
0c21d60349 Improve documentation for setup() and teardown() nose support
Fix #9549
2022-10-07 11:10:28 -03:00
Bruno Oliveira
4545fcff05 Merge pull request #10335 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.9.0 2022-10-07 11:00:10 -03:00
Ronny Pfannschmidt
24ef7c98e8 Merge pull request #10343 from RonnyPfannschmidt/fix-10342-warn-explicit-add-location
fix #10342: put location into warning exceptions
2022-10-07 13:04:32 +02:00
Bruno Oliveira
c4981f5a1b Merge pull request #10347 from The-Compiler/hookimpl-marker-docs 2022-10-07 07:51:16 -03:00
Ronny Pfannschmidt
7a15bad89b Update src/_pytest/warning_types.py
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2022-10-07 12:46:40 +02:00
Florian Bruhin
72cac9b1af Mark tryfirst/trylast as deprecated in their docs.
Follow-up to #9118
2022-10-07 12:16:53 +02:00
Ran Benita
2df0d9656c ci: fix PR not triggering workflows by switching back to pytestbot access token
The builtin actions token is not allowed to trigger further workflows.
So when we create a PR using that token, the PR checks don't run, and a
maintainer must close & open the PR to make them run. This is quite
annoying, so switch back to the "machine user" approach.

Fixes #9554.
2022-10-06 21:14:24 +03:00
Bruno Oliveira
4677580cae Merge pull request #10339 from Moisan/doc_broken_links 2022-10-06 13:05:11 -03:00
Ronny Pfannschmidt
14919c4bbb fix #10342: put location into warning exceptions
as the warning systems own warn_explicit looses the information
we add them explicitly to the warning exceptions
2022-10-06 11:44:05 +02:00
Thierry Moisan
06007de7ba Fix a few broken links in the documentation 2022-10-05 10:24:55 -04:00
pre-commit-ci[bot]
4ee6e900a0 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/autoflake: v1.6.0 → v1.6.1](https://github.com/PyCQA/autoflake/compare/v1.6.0...v1.6.1)
- [github.com/asottile/reorder_python_imports: v3.8.2 → v3.8.3](https://github.com/asottile/reorder_python_imports/compare/v3.8.2...v3.8.3)
- [github.com/asottile/pyupgrade: v2.38.0 → v2.38.2](https://github.com/asottile/pyupgrade/compare/v2.38.0...v2.38.2)
- [github.com/pre-commit/mirrors-mypy: v0.971 → v0.981](https://github.com/pre-commit/mirrors-mypy/compare/v0.971...v0.981)
2022-10-03 23:32:26 +00:00
dependabot[bot]
eab875509d build(deps): Bump pytest-mock in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.8.2 to 3.9.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.8.2...v3.9.0)

---
updated-dependencies:
- dependency-name: pytest-mock
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-03 03:01:46 +00:00
Ronny Pfannschmidt
2be1b8f355 Merge pull request #9118 from RonnyPfannschmidt/fix-4562-deprecate-hookmarkers
deprecate hook configuration via marks/attributes
2022-10-02 12:59:16 +02:00
Adam Turner
594413e8f0 Use an explicit encoding when opening os.devnul
Although slightly pointless, this avoids an `EncodingWarning` in Python 3.10
or greater when running under the `-X warn_default_encoding` flag.
2022-09-30 23:43:27 +01:00
Ronny Pfannschmidt
ce3e2e922b bump plugin test pytest cov pin 2022-09-28 22:28:03 +02:00
Bruno Oliveira
59b8ec3ce1 Merge pull request #10308 from pytest-dev/pre-commit-ci-update-config 2022-09-21 16:03:59 -03:00
Ronny Pfannschmidt
ae9dbf5006 add docstring to warn_explicit_for 2022-09-20 16:24:32 +02:00
Ronny Pfannschmidt
7e8a4849d8 unify option extraction for legacy hook marks 2022-09-20 16:24:32 +02:00
Ronny Pfannschmidt
e3294398d6 simplify typing for legacy hook mark support 2022-09-20 16:24:23 +02:00
Ronny Pfannschmidt
b1fb9a9c8d handle non-true options in hookspec warning 2022-09-20 16:22:26 +02:00
Ronny Pfannschmidt
8c52dc5b7e remove the setup.py for the py.test project which for deprecation has been deployed since 2014 2022-09-20 16:22:26 +02:00
Ronny Pfannschmidt
0fdacb6db5 deprecate hook configuration via marks/attributes
fixes #4562
2022-09-20 16:22:26 +02:00
pre-commit-ci[bot]
256ab097a2 [pre-commit.ci] pre-commit autoupdate
updates:
- https://github.com/myint/autoflakehttps://github.com/PyCQA/autoflake
- [github.com/PyCQA/autoflake: v1.5.3 → v1.6.0](https://github.com/PyCQA/autoflake/compare/v1.5.3...v1.6.0)
- [github.com/asottile/pyupgrade: v2.37.3 → v2.38.0](https://github.com/asottile/pyupgrade/compare/v2.37.3...v2.38.0)
2022-09-19 23:24:54 +00:00
Anthony Sottile
5bd41befa8 Merge pull request #10301 from Zoorken/main
doc: Fix 404 'identify flaky test' link (#10244)
2022-09-16 10:51:08 -04:00
Fredrik Berndtsson
246129089c doc: Fix 404 'identify flaky test' link (#10244) 2022-09-15 23:34:22 +02:00
Florian Bruhin
34765f6b2e doc: Add link for enterPy training (#10299) 2022-09-15 17:07:02 +02:00
Bruno Oliveira
33a083e844 Merge pull request #10291 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-22.8.0 2022-09-12 09:11:58 -03:00
Bruno Oliveira
77d2c9631a Merge pull request #10289 from pytest-dev/update-plugin-list/patch-85da6cad1
[automated] Update plugin list
2022-09-12 09:08:40 -03:00
dependabot[bot]
d416fbab91 build(deps): Bump twisted in /testing/plugins_integration
Bumps [twisted](https://github.com/twisted/twisted) from 22.4.0 to 22.8.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-22.4.0...twisted-22.8.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-12 03:01:53 +00:00
pytest bot
f53b49c8c4 [automated] Update plugin list 2022-09-11 00:22:18 +00:00
Bruno Oliveira
85da6cad11 Merge pull request #10285 from skhomuti/allure-pytest-to-plugins
Add allure-pytest to the popular plugins list
2022-09-09 09:00:32 -03:00
skhomuti
c326bd5669 Add allure-pytest to the popular plugins list 2022-09-08 22:12:44 +05:00
Bruno Oliveira
a734dab00d Merge pull request #10279 from The-Compiler/training-update-3 2022-09-07 10:15:02 -03:00
Florian Bruhin
1e0aa16908 Update open trainings 2022-09-07 14:48:49 +02:00
Bruno Oliveira
b34eb0860c Merge pull request #10275 from pytest-dev/pre-commit-ci-update-config 2022-09-06 08:33:51 -03:00
Bruno Oliveira
77e34526e8 Merge pull request #10225 from nicoddemus/sort-fixtures-docs 2022-09-06 08:33:27 -03:00
Bruno Oliveira
abf4941f3e Merge pull request #10272 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.1.1
build(deps): Bump django from 4.1 to 4.1.1 in /testing/plugins_integration
2022-09-06 08:33:04 -03:00
pre-commit-ci[bot]
b4ae5e4a35 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 22.6.0 → 22.8.0](https://github.com/psf/black/compare/22.6.0...22.8.0)
- [github.com/myint/autoflake: v1.5.1 → v1.5.3](https://github.com/myint/autoflake/compare/v1.5.1...v1.5.3)
2022-09-05 23:33:43 +00:00
dependabot[bot]
649b2e7f30 build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.1 to 4.1.1.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/commits)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-05 13:09:31 +00:00
Bruno Oliveira
6ad32a9c5c Merge pull request #10268 from pytest-dev/update-plugin-list/patch-4ed2b3a73
[automated] Update plugin list
2022-09-04 12:59:41 -03:00
pytest bot
50f390f015 [automated] Update plugin list 2022-09-04 00:23:26 +00:00
Bruno Oliveira
4ed2b3a733 Merge pull request #10267 from nicoddemus/cherry-pick-release
Merge pull request #10259 from pytest-dev/release-7.1.3
2022-09-02 08:34:50 -03:00
Bruno Oliveira
7f4b63b143 Merge pull request #10259 from pytest-dev/release-7.1.3
Prepare release 7.1.3

(cherry picked from commit 3739e6cd48)
2022-09-02 08:24:18 -03:00
Philipp A
245a8c23dd Revamp good practices (#10206)
* Recommend importlib import mode for new projects
* Recommend src layout more strongly
* Switch to hatchling as the packaging tool in the example (following PyPA)
* Add explanation about the different import modes
2022-09-01 07:55:41 -03:00
Bruno Oliveira
a9bbfb87d6 Merge pull request #10252 from nicoddemus/fix-regendoc
Fix regendoc
2022-08-31 14:32:36 -03:00
Bruno Oliveira
1caa099e42 Fix regendoc
The finalizers example was wiping out code needed for the examples below.
2022-08-31 14:28:33 -03:00
pre-commit-ci[bot]
4b77638ba8 [pre-commit.ci] pre-commit autoupdate (#10256)
updates:
- [github.com/myint/autoflake: v1.4 → v1.5.1](https://github.com/myint/autoflake/compare/v1.4...v1.5.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-08-30 07:11:58 -03:00
github-actions[bot]
0fc3a977a9 [automated] Update plugin list (#10253)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-08-29 17:49:38 -03:00
Gergely Kalmár
adaa463ee3 Ignore editable installation modules (#10231)
Fixes #10230
2022-08-26 09:46:47 -03:00
pre-commit-ci[bot]
42776c0949 [pre-commit.ci] pre-commit autoupdate (#10178)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/PyCQA/flake8: 4.0.1 → 5.0.4](https://github.com/PyCQA/flake8/compare/4.0.1...5.0.4)
- [github.com/asottile/pyupgrade: v2.37.2 → v2.37.3](https://github.com/asottile/pyupgrade/compare/v2.37.2...v2.37.3)
- [github.com/asottile/setup-cfg-fmt: v1.20.2 → v2.0.0](https://github.com/asottile/setup-cfg-fmt/compare/v1.20.2...v2.0.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Configure setup-cfg-fmt to include version specifiers

* Update .pre-commit-config.yaml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-08-22 20:19:44 -03:00
Bruno Oliveira
059bc2443a Merge pull request #10234 from pytest-dev/update-plugin-list/patch-d9d890ee1
[automated] Update plugin list
2022-08-21 04:44:10 -03:00
pytest bot
932264d8fd [automated] Update plugin list 2022-08-21 00:21:46 +00:00
Bruno Oliveira
d9d890ee15 Merge pull request #10229 from webknjaz/patch-1
Drop `wheel` from `pyproject.toml` example
2022-08-19 14:30:51 -03:00
Sviatoslav Sydorenko
71aa1388e0 Drop wheel from pyproject.toml example
It is unnecessary and has been deleted from the setuptools' docs too.
The setuptools' PEP 517 build backend implementation has been
auto-adding the `wheel` dependency since it's first been implemented.
2022-08-19 19:01:40 +02:00
John Litborn
69f2855cc8 fallback to native traceback when handling ExceptionGroup (take 2) [SQUASH] (#10209)
* Squashed commit of the following:

commit 41d339c46763bbe26123e1e6504b6e32290e33e1
Author: Cheukting <cheukting.ho@gmail.com>
Date:   Thu Jun 23 17:01:04 2022 +0800

    test in all py versions

commit b3572a5a12672228c3276fc8c8e05980dfb7888a
Author: Cheukting <cheukting.ho@gmail.com>
Date:   Thu Jun 23 16:41:06 2022 +0800

    add test

commit 7166a2a51e4f99046b028b663c193d8b558c7fd4
Author: Cheukting <cheukting.ho@gmail.com>
Date:   Thu Jun 23 16:00:07 2022 +0800

    update changelog

commit b958c73d489157f0c0d4e46425083a5e2e2bc851
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Thu Jun 23 07:50:52 2022 +0000

    [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci

commit ea7f376c6ca37c40c83df0e4a1cfaaedb34bae91
Author: Cheukting <cheukting.ho@gmail.com>
Date:   Thu Jun 23 15:48:21 2022 +0800

    Fix MyPy

commit 97469beb1da40257e9a061a5e19548546c9312c4
Author: Cheukting <cheukting.ho@gmail.com>
Date:   Thu Jun 23 15:03:48 2022 +0800

    fix if ExceptionGroup not exist

commit 84e553642cd69b4d499231d733df91ebfa84c7ad
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Thu Jun 23 03:43:27 2022 +0000

    [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci

commit 76bbef449b88bbd74fb5cca3b5293337a624ef03
Author: Cheukting <cheukting.ho@gmail.com>
Date:   Thu Jun 23 11:40:41 2022 +0800

    adding changelog

commit db82bebc5a4969e2083adcd97bdfd2a63bb17d98
Author: Cheukting <cheukting.ho@gmail.com>
Date:   Thu Jun 23 11:33:10 2022 +0800

    fall back to native when handeling to exception groups

* Typed ExceptionGroupTypes and changed to BaseExceptionGroup, fixed exceptionchain (excinfo->excinfo_, set reprcrash. Extended tests, though they're wip.

* added exceptiongroup to pre-commit-config, moved away from tuple to directly defining BaseExceptionGroup, added block comment, added match line for inner exception, changked mark.skipif to importorskip to not need top-level import, changed tox.ini a bit - only uncovered should now be py37 without exceptiongroup, due to hypothesis

* added py311-exceptiongroup to github CI, exceptiongroup is now a hard dependency on py<3.11, renamed bad variable names

* added use_coverage to ubuntu-py311

* import BaseExceptionGroup with explicit version check instead of try/catch

* removed from CI, added comments to tox and pre-commit
2022-08-17 09:16:32 -07:00
Tatiana Ovary
3039391b83 Update documentation on how pytest.warns affects DeprecationWarning #9291 (#10141)
Co-authored-by: Dani Sancas <lord.sancas@gmail.com>

On-behalf-of: @clarityai-eng <tech@clarity.ai>

Signed-off-by: Tatiana Ovary <tatiana.ovary@clarity.ai>
2022-08-17 11:44:58 -03:00
Bruno Oliveira
832100955a Sort fixtures in reference.rst alphabetically
While taking a look at the docs I noticed they were not properly sorted.

This just moves the sections around so they are sorted alphabetically, without any other changes.
2022-08-17 11:40:03 -03:00
Ran Benita
bec2b8ee3a Merge pull request #10220 from bluetech/build-cleanups
Two minor cleanups in pyproject.toml and setup.cfg
2022-08-15 20:53:24 +03:00
aizpurua23a
7378f35b03 Update fixtures.rst w/ finalizer order
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-08-15 14:00:03 -03:00
Ran Benita
b6eaf319d1 Merge pull request #10219 from bluetech/parametrize-argnames-type
mark: allow any Sequence[str] for parametrize(argnames), not just list/tuple
2022-08-15 19:59:45 +03:00
Bruno Oliveira
2e7c718373 Add reference to the Where to patch docs in monkeypatch.setattr (#10217)
This should help users with the common issue of patching the wrong place.

Also took the opportunity of using proper links in the monkeypatch introduction.

Related to #10216

Co-authored-by: Ran Benita <ran@unusedvar.com>
2022-08-15 13:55:19 -03:00
Ran Benita
08dfd3124c Merge pull request #10218 from bluetech/sphinx5-changelog
changelog: add missing entry for PR #9248 (Sphinx 5)
2022-08-15 19:54:48 +03:00
Ran Benita
56862c03cb pyproject.toml: remove wheel from build-system.requires
It's not required -- see
https://github.com/pypa/packaging.python.org/pull/1050
2022-08-15 19:41:57 +03:00
Ran Benita
67e29d2548 mark: allow any Sequence[str] for parametrize(argnames), not just list/tuple
The main motivation for this change is to simplify the type shown in
code editors -- `Sequence[str]` is easier to follow than
`Union[list[str], tuple[str, ...]]`.

It also permits using other types if desired. It might lead to problems
if someone uses some oddball sequence type, but hopefully they won't do
that.
2022-08-15 19:38:09 +03:00
Ran Benita
cb65f64572 changelog: add missing entry for PR #9248 2022-08-15 19:07:36 +03:00
github-actions[bot]
f425dfc158 [automated] Update plugin list (#10214)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-08-14 05:07:01 -03:00
Ran Benita
63d2f7f7f8 Merge pull request #9248 from bluetech/sphinx4
doc: support sphinx 5
2022-08-13 22:35:55 +03:00
Sviatoslav Sydorenko
739322af03 Mention monkeypatch.context() in the docs (#10192)
In addition:

* Improve the docs a bit with links.
* Recommend `context()` instead of `undo()`.
2022-08-13 16:07:27 -03:00
Ran Benita
beae7fd0ba doc: workaround for ugly API docs for overloaded functions with new Sphinx
New Sphinx added support for overloads and always displays them all with
full type annotations etc. This regresses the API reference for
overloaded functions like `fixture()`, `warns()`, `raises()` and friends
to become impossible to read.

I tried various workarounds but none worked except this one.
2022-08-13 21:46:49 +03:00
Ran Benita
7431750bb6 doc: have tighter control on what autodoc shows
New versions of sphinx starting showing `__init__` parameters even when
we don't want them to show because they are private (have `_ispytest`
argument).

The only working solution I found was to switch to
`autodoc_typehints_description_target = "documented"` and explicitly
document parameters for which we want to show the types. It's a little
tedious and repetitive in some simple cases, but overall it results in
nicer API docs.
2022-08-13 21:46:49 +03:00
Ran Benita
cb7f5ed3b1 doc: require sphinx 5
Fix #9836.
2022-08-13 21:45:54 +03:00
Nhieuvu1802
c72d202317 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#10212)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-12 20:56:51 -03:00
holesch
cc0092b9d8 JUnit XML: Escape error messages in setup/teardown (#10190)
Co-authored-by: Holesch, Simon (BSH) <simon.holesch@bshg.com>
2022-08-12 11:11:03 +02:00
dependabot[bot]
433efaeaa9 build(deps): Bump django in /testing/plugins_integration (#10195)
Bumps [django](https://github.com/django/django) from 4.0.6 to 4.1.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.0.6...4.1)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-12 11:09:06 +02:00
Brandon Chinn
4d430ea6ff Fix partially unknown type (#10204) 2022-08-12 11:08:39 +02:00
github-actions[bot]
abd5df4b3c [automated] Update plugin list (#10194)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-08-12 11:06:48 +02:00
Thomas Grainger
58cf20edf0 Update :class:pytest.PytestUnhandledCoroutineWarning to a deprecation; it will raise an error in pytest 8. [SQUASH] (#10012)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-08-08 10:14:49 +01:00
Bruno Oliveira
f43ddd8acd Merge pull request #10177 from pytest-dev/update-plugin-list/patch-b4ab2f094
[automated] Update plugin list
2022-07-31 10:50:44 -03:00
Robert O'Shea
1c31a7e659 Added file-like methods to DontReadFromInput (#10173)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

Fixes #10150
2022-07-31 13:44:02 +00:00
pytest bot
c0e3071fdf [automated] Update plugin list 2022-07-31 00:22:46 +00:00
Bruno Oliveira
b4ab2f0942 Merge pull request #10170 from pytest-dev/pre-commit-ci-update-config 2022-07-25 20:15:38 -03:00
pre-commit-ci[bot]
dbc1017b08 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v3.8.1 → v3.8.2](https://github.com/asottile/reorder_python_imports/compare/v3.8.1...v3.8.2)
- [github.com/asottile/pyupgrade: v2.37.1 → v2.37.2](https://github.com/asottile/pyupgrade/compare/v2.37.1...v2.37.2)
- [github.com/asottile/setup-cfg-fmt: v1.20.1 → v1.20.2](https://github.com/asottile/setup-cfg-fmt/compare/v1.20.1...v1.20.2)
- [github.com/pre-commit/mirrors-mypy: v0.961 → v0.971](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.971)
2022-07-25 22:19:32 +00:00
Bruno Oliveira
70659b8c34 Merge pull request #10165 from pytest-dev/update-plugin-list/patch-6c57cc172
[automated] Update plugin list
2022-07-23 23:40:51 -03:00
pytest bot
3bf15135e4 [automated] Update plugin list 2022-07-24 00:25:01 +00:00
Bruno Oliveira
6c57cc1727 Merge pull request #10158 from albertvillanova/patch-3 2022-07-23 14:01:38 -03:00
Bruno Oliveira
c0843f94e4 Merge pull request #10157 from albertvillanova/patch-2
Fix typo in example/markers documentation
2022-07-23 14:00:29 -03:00
Albert Villanova del Moral
8c5487fd6b Fix cross-reference in reference/reference docs 2022-07-20 00:01:23 +02:00
Albert Villanova del Moral
4696ba74f9 Fix typo in example/markers docs 2022-07-19 22:16:14 +02:00
Bruno Oliveira
34a285986e Merge pull request #10143 from sirosen/monkeypatch-ctx-howto 2022-07-15 23:08:21 -03:00
Stephen Rosen
b8e2f42ec1 Add monkeypatch.context() to how-to doc intro 2022-07-15 19:26:36 +00:00
Wolfremium
70cac3d464 Explicit note that tmpdir fixture is discouraged in favour of tmp_path #9937 (#10138)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: kevin.hierro-ext <kevin.hierro-ext@clarity.ai>
Co-authored-by: Dani Sancas <lord.sancas@gmail.com>
2022-07-15 08:40:18 -03:00
Nipunn Koorapati
c1d134172c Add typing for FixtureRequest.param (#10133)
For now, mark it as Any until #8073 is solved

Fixes #9514
2022-07-14 20:36:05 -03:00
Bruno Oliveira
cbcb3a356e Merge pull request #10132 from hroncok/python3.11.0b4 2022-07-14 08:37:08 -03:00
Miro Hrončok
09b2c95320 Adjust tests for a last minute Python 3.11 change in the traceback format
See https://github.com/python/cpython/issues/93883
and https://github.com/python/cpython/pull/93994

Fixes https://github.com/pytest-dev/pytest/issues/10131
2022-07-13 17:14:37 +02:00
Bruno Oliveira
c2b1d5b368 Merge pull request #10127 from pytest-dev/pre-commit-ci-update-config 2022-07-11 19:56:56 -03:00
pre-commit-ci[bot]
5c513a5fb3 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v3.3.0 → v3.8.1](https://github.com/asottile/reorder_python_imports/compare/v3.3.0...v3.8.1)
- [github.com/asottile/pyupgrade: v2.34.0 → v2.37.1](https://github.com/asottile/pyupgrade/compare/v2.34.0...v2.37.1)
2022-07-11 21:57:36 +00:00
Anthony Sottile
7b9f71d84f Merge pull request #10123 from nicoddemus/fix-mypy-pre-commit
Fix mypy pre-commit run
2022-07-11 08:47:45 -04:00
Bruno Oliveira
334d6514c6 Fix mypy pre-commit run
This started to fail recently with:

```
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

src/_pytest/assertion/rewrite.py:284: error: Returning Any from function declared to return "TraversableResources"  [no-any-return]
Found 1 error in 1 file (checked 219 source files)
```

Not sure why that started failing, but seems like ignoring that error specifically is OK.
2022-07-11 08:27:09 -03:00
Bruno Oliveira
f6dc71c8de Merge pull request #10120 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.8.2
build(deps): Bump pytest-mock from 3.8.1 to 3.8.2 in /testing/plugins_integration
2022-07-11 08:06:23 -03:00
Bruno Oliveira
8c60fa1ef9 Merge pull request #10121 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-sugar-0.9.5
build(deps): Bump pytest-sugar from 0.9.4 to 0.9.5 in /testing/plugins_integration
2022-07-11 08:06:09 -03:00
Bruno Oliveira
b83a74a303 Merge pull request #10122 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-bdd-6.0.1
build(deps): Bump pytest-bdd from 5.0.0 to 6.0.1 in /testing/plugins_integration
2022-07-11 08:05:48 -03:00
dependabot[bot]
9c5b6fbab2 build(deps): Bump pytest-bdd in /testing/plugins_integration
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 5.0.0 to 6.0.1.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/5.0.0...6.0.1)

---
updated-dependencies:
- dependency-name: pytest-bdd
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 03:02:51 +00:00
dependabot[bot]
b1948c60ac build(deps): Bump pytest-sugar in /testing/plugins_integration
Bumps [pytest-sugar](https://github.com/Teemu/pytest-sugar) from 0.9.4 to 0.9.5.
- [Release notes](https://github.com/Teemu/pytest-sugar/releases)
- [Changelog](https://github.com/Teemu/pytest-sugar/blob/master/CHANGES.rst)
- [Commits](https://github.com/Teemu/pytest-sugar/commits)

---
updated-dependencies:
- dependency-name: pytest-sugar
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 03:02:49 +00:00
dependabot[bot]
da68c9d5bc build(deps): Bump pytest-mock in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.8.1 to 3.8.2.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.8.1...v3.8.2)

---
updated-dependencies:
- dependency-name: pytest-mock
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 03:02:47 +00:00
Bruno Oliveira
29041e1e1f Merge pull request #10118 from pytest-dev/update-plugin-list/patch-7dc540f25
[automated] Update plugin list
2022-07-10 07:51:38 -03:00
pytest bot
dda7673f57 [automated] Update plugin list 2022-07-10 00:24:23 +00:00
Anthony Sottile
7dc540f258 Merge pull request #10115 from pytest-dev/atomicwrites-windows
replace atomicwrites with os.replace
2022-07-08 22:06:56 -04:00
Anthony Sottile
4cd0322ca1 replace atomicwrites with os.replace 2022-07-08 18:36:10 -07:00
Ronny Pfannschmidt
966d4fb3e4 Merge pull request #10051 from EmptyRabbit/dev_main
Fix stage caplog records not clear
2022-07-08 07:46:10 +02:00
Bruno Oliveira
8726597321 Update changelog/9877.bugfix.rst 2022-07-07 09:39:57 -03:00
EmptyRabbit
aa83fa353c Update changelog/9877.bugfix.rst
Co-authored-by: Ronny Pfannschmidt <opensource@ronnypfannschmidt.de>
2022-07-07 19:29:50 +08:00
Florian Bruhin
4449bdc068 Remove europython training (#10107) 2022-07-06 13:05:08 +02:00
Bruno Oliveira
929e7d5ae0 Merge pull request #10106 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.0.6 2022-07-06 07:52:52 -03:00
dependabot[bot]
6d7973942f build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.0.5 to 4.0.6.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.0.5...4.0.6)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 22:37:17 +00:00
Bruno Oliveira
4414c4adae Merge pull request #10102 from pytest-dev/pre-commit-ci-update-config 2022-07-04 20:27:59 -03:00
pre-commit-ci[bot]
b99541e744 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 22.3.0 → 22.6.0](https://github.com/psf/black/compare/22.3.0...22.6.0)
- [github.com/asottile/reorder_python_imports: v3.1.0 → v3.3.0](https://github.com/asottile/reorder_python_imports/compare/v3.1.0...v3.3.0)
2022-07-04 22:38:23 +00:00
Bruno Oliveira
5f57481563 Merge pull request #10099 from pytest-dev/update-plugin-list/patch-b08c1dcf0
[automated] Update plugin list
2022-07-03 09:36:57 -03:00
pytest bot
04de180f41 [automated] Update plugin list 2022-07-03 00:22:59 +00:00
Anthony Sottile
b08c1dcf0e Merge pull request #10093 from pytest-dev/move-changelog-to-bugfix
git mv changelog/3396.{improvement,bugfix}.rst
2022-06-30 09:07:24 -04:00
Anthony Sottile
3e590fe79e git mv changelog/3396.{improvement,bugfix}.rst 2022-06-30 05:47:02 -07:00
Anthony Sottile
7dcabc1f49 Merge pull request #10088 from alicederyn/doctest.importmode
Pass importmode to import_path in DoctestModule
2022-06-29 17:57:37 -04:00
Anthony Sottile
2941da0f2b Merge pull request #10090 from pytest-dev/update-does-not-raise
update does_not_raise docs now that pytest is 3.7+ only
2022-06-29 14:00:03 -04:00
Anthony Sottile
1b47de7d7f update does_not_raise docs now that pytest is 3.7+ only 2022-06-29 13:13:15 -04:00
Alice Purcell
85000f037f Added Alice Purcell to AUTHORS 2022-06-29 14:39:04 +01:00
Alice Purcell
c34eaaaa1c Pass importmode to import_path in DoctestModule
This allows doctest to be used with namespace modules
2022-06-29 14:38:59 +01:00
Bruno Oliveira
06738e36df Merge pull request #10081 from nicoddemus/unittest-cls-skip-10060 2022-06-28 12:49:50 -03:00
Anthony Sottile
94bc31b07d Merge pull request #10086 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-06-28 11:33:04 -04:00
pre-commit-ci[bot]
b961ef5b79 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.2.0 → v4.3.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.2.0...v4.3.0)
- [github.com/asottile/pyupgrade: v2.32.1 → v2.34.0](https://github.com/asottile/pyupgrade/compare/v2.32.1...v2.34.0)
- [github.com/pre-commit/mirrors-mypy: v0.960 → v0.961](https://github.com/pre-commit/mirrors-mypy/compare/v0.960...v0.961)
2022-06-27 20:50:23 +00:00
Bruno Oliveira
bd642fac70 Do not call tearDown for skipped unittest.TestCases with --pdb
Fix #10060
2022-06-27 10:33:37 -03:00
Bruno Oliveira
da9a2b584e Merge pull request #10078 from nicoddemus/pathsep-9791 2022-06-27 09:58:38 -03:00
Bruno Oliveira
8bbd35aa69 Merge pull request #10082 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.8.1
build(deps): Bump pytest-mock from 3.7.0 to 3.8.1 in /testing/plugins_integration
2022-06-27 07:15:41 -03:00
dependabot[bot]
0b1e9ba270 build(deps): Bump pytest-mock in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.7.0 to 3.8.1.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.7.0...v3.8.1)

---
updated-dependencies:
- dependency-name: pytest-mock
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-27 03:02:47 +00:00
Bruno Oliveira
f92c4a77ad Use PurePath directly instead of os.path.sep in rewrite.py
Given we are already creating a `PurePath`, just pass the parts directly to it.

This avoids using `os.path.sep`, that although is an official API, seems not to be available in all systems.

Fix #9791
2022-06-26 21:29:05 -03:00
Bruno Oliveira
9a037a5713 Merge pull request #10076 from pytest-dev/update-plugin-list/patch-aafac5578
[automated] Update plugin list
2022-06-26 10:54:01 -03:00
Bruno Oliveira
11fb5cd331 Merge pull request #10054 from SnoopJeDi/doc/xfail-multiple-exceptions
Indicate support for a tuple of exceptions in xfail raises=
2022-06-26 09:54:18 -03:00
pytest bot
62d975a69e [automated] Update plugin list 2022-06-26 00:25:07 +00:00
Bruno Oliveira
aafac5578c Merge pull request #10056 from paulreece/fixture-path-doc-fix
Added Docstring description for the Path property of FixtureRequest #9975
2022-06-25 20:55:23 -03:00
Zac Hatfield-Dodds
2b70e7f4df Merge pull request #10064 from hugovk/test-me-fix-logging.warn-deprecation
Replace deprecated logging.warn with logging.warning
2022-06-24 23:29:26 -07:00
Zac Hatfield-Dodds
d2a206683c Merge pull request #10073 from Kache/main
Clarify writing_plugins naming instructions
2022-06-24 23:27:58 -07:00
zx.qiu
f29f79e39f Use records.clear() in LogCaptureHandler when caplog.clear() 2022-06-24 23:04:04 +08:00
zx.qiu
c7e784f95d Fix stage caplog records not clear
Closes #9877
2022-06-24 23:03:37 +08:00
Kevin C
0a7b8722e5 Clarify writing_plugins naming instructions
Fixes: #10072
2022-06-23 18:03:18 -07:00
Bruno Oliveira
aa55975c7d Doc: Clear mailbox before deleting the user (#10068) 2022-06-23 21:47:39 -03:00
Anthony Sottile
141c5e5a89 Merge pull request #10070 from pytest-dev/typos
fix some typos to ensure pre-commit.ci fixes main
2022-06-22 11:38:36 -04:00
pre-commit-ci[bot]
cba65e74b3 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-06-22 15:32:05 +00:00
Anthony Sottile
74691346bd fix some typos to ensure pre-commit.ci fixes main 2022-06-22 08:29:02 -07:00
pre-commit-ci[bot]
6db715c205 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-06-22 12:16:24 +00:00
Chanvin Xiao
1e6a587363 Doc: Clear mailbox before deleting the user 2022-06-22 20:06:37 +08:00
Hugo van Kemenade
052da7128b Replace deprecated logging.warn with .warning 2022-06-21 22:53:28 +03:00
Paul Reece
cdc287d21a Added self to Authors 2022-06-17 12:00:18 -04:00
Paul Reece
5a9536cf42 Added Docstring description for the Path property of the FixtureRequest class. 2022-06-17 11:52:18 -04:00
James Gerity
17c385180d Indicate support for a tuple of exceptions in xfail raises= 2022-06-16 11:39:41 -04:00
Chris Wheeler
fab696dcd1 Add support for .pytest.ini as an alternative to pytest.ini
Closes #9987
2022-06-14 08:24:35 -03:00
Bruno Oliveira
2cd41651bb Merge pull request #10031 from The-Compiler/trainings
Update training list
2022-06-14 07:31:06 -03:00
Bruno Oliveira
5ef064b602 Mark pdb+expect tests as xfail for now (#10043)
Related to #10042
2022-06-14 07:29:19 -03:00
Bruno Oliveira
d6b837e2d3 Mark pdb+expect tests as xfail for now
Related to #10042
2022-06-14 07:01:34 -03:00
Zach OBrien
96412d19ab Fix representation of tuples in approx
Closes #9917
2022-06-14 06:54:32 -03:00
Bruno Oliveira
bb94e83b49 Merge pull request #10035 from pytest-dev/update-plugin-list/patch-04be900d0
[automated] Update plugin list
2022-06-13 09:10:40 -03:00
pytest bot
1a50e5222f [automated] Update plugin list 2022-06-12 00:22:15 +00:00
Florian Bruhin
27c94f573c Update training list 2022-06-10 15:40:53 +02:00
Bruno Oliveira
04be900d06 Update location of usage.rst to fix manpage compilation (#10026)
`usage.rst` has been moved from `doc/en` to `doc/en/how-to`, so the `man_pages` configuration
value needs to be updated to the new location, so that we dont get this warning:

    writing... WARNING: "man_pages" config value references unknown document usage
2022-06-07 18:49:37 -03:00
Sandro Tosi
fe2c74cb1a Update location of usage.rst to fix manpage compilation
`usage.rst` has been moved from `doc/en` to `doc/en/how-to`, so the `man_pages` configuration
value needs to be updated to the new location, so that we dont get this warning:

    writing... WARNING: "man_pages" config value references unknown document usage
2022-06-07 14:43:34 -04:00
dependabot[bot]
083285948f build(deps): Bump django from 4.0.4 to 4.0.5 in /testing/plugins_integration (#10021)
Bumps [django](https://github.com/django/django) from 4.0.4 to 4.0.5.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.0.4...4.0.5)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-07 08:01:15 -03:00
github-actions[bot]
433c7376c5 [automated] Update plugin list (#10020)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-06-05 12:44:38 -03:00
Neil Girdhar
5adfb0e187 Use symbolic NoReturn as a type annotation (#10018)
Use symbolic NoReturn as a type annotation
2022-06-03 07:59:48 -03:00
Tony Narlock
c2f684fcd6 docs(monkeypatch): Fix autodoc reference links (#10013)
Close #10014
2022-06-02 10:16:59 -03:00
Bruno Oliveira
130c954bb1 Merge pull request #9904 from johnkangw/notes_update 2022-05-31 16:35:29 -03:00
Hugo van Kemenade
e54c6a1362 Document the --code-highlight default (#9883)
Also normalized all help text using the patterns:

* `One sentence help text`
* `First sentence of help. Second sentence of help.`
2022-05-31 16:32:51 -03:00
Bruno Oliveira
9a8f5dd73e Merge pull request #10007 from nicoddemus/importlib-docs 2022-05-31 16:24:55 -03:00
Bruno Oliveira
6017666fe1 Do not advertise that importlib will be default import mode
It is clear at this point that changing the default would break a lot of suites, and is not a clear win in all cases anyway.

Close #10003
2022-05-31 09:53:23 -03:00
Anthony Sottile
a72e8b3d3e Merge pull request #10006 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-05-30 18:31:30 -04:00
pre-commit-ci[bot]
0efd7a6ec6 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.950 → v0.960](https://github.com/pre-commit/mirrors-mypy/compare/v0.950...v0.960)
2022-05-30 21:00:26 +00:00
Ronny Pfannschmidt
c533015c56 Merge pull request #9880 from jparise/getfixturemarker-attr
Use safe_getattr() in getfixturemarker()
2022-05-30 05:54:40 +02:00
github-actions[bot]
e547cd565d [automated] Update plugin list (#10001)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-05-29 13:04:53 -03:00
Zac Hatfield-Dodds
a47e91e077 Merge pull request #9893 from jparise/pytester-mkdir-path 2022-05-27 20:51:50 -07:00
Zac Hatfield-Dodds
420dc7824b Merge pull request #9990 from petebman/improve_getfixturevalue_error_message 2022-05-27 20:40:55 -07:00
Cheuk Ting Ho
c988e49af6 Warn when test functions return other than None (#9956)
Closes #7337
2022-05-25 09:48:02 -03:00
github-actions[bot]
31f9e5bcdd [automated] Update plugin list (#9985)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-05-24 11:12:31 +02:00
Tim Hoffmann
9a9acf13f8 Declutter doc entry page (#9969)
- Remove the index page https://docs.pytest.org/en/7.1.x/genindex.html
  Such an index is reasonable in books but not so much in HTML pages.
  IMHO the integrated search is much more user-friendly and sufficient.

- Remove the PDF link from the entry page. The PDF is already linked
  in the sidebar. I anticipate that getting the PDF documentation is
  not a major concern for users.

- Remove the sections "Changelog" and "License" from the entry page.
  These section only contain links to the respective pages.
  These topics are purely technical. They should be easily accessible
  (which they still are through sidebar section "About the project"),
  but they don't need additional advertisement through a dedicated
  section on the entry page.
2022-05-24 10:23:39 +02:00
Jon Parise
8ac6dce2c7 Add shell-style wildcard support to 'testpaths' (#9897)
This is especially useful for large repositories (e.g. monorepos) that
use a hierarchical file system organization for nested test paths.

    src/*/tests

The implementation uses the standard `glob` module to perform wildcard
expansion in Config.parse().

The related logic that determines whether or not to include 'testpaths'
in the terminal header was previously relying on a weak heuristic: if
Config.args matched 'testpaths', then its value was printed. That
generally worked, but it could also print when the user explicitly used
the same arguments on the command-line as listed in 'testpaths'. Not a
big deal, but it shows that the check was logically incorrect.

Now that 'testpaths' can contain wildcards, it's no longer possible to
perform this simple comparison, so this change also introduces a public
Config.ArgSource enum and Config.args_source attribute that explicitly
names the "source" of the arguments: the command line, the invocation
directory, or the 'testdata' configuration value.
2022-05-24 10:20:51 +02:00
Pete Baughman
0e62861e84 Improve error message in getfixturevalue 2022-05-23 17:54:22 +00:00
Bruno Oliveira
611b579d21 Merge pull request #9963 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.6.1 2022-05-17 09:12:45 -03:00
Bruno Oliveira
8469f44401 Merge pull request #9970 from ezio-melotti/fix-tempdirfactory-docstring
Fix rst markup in TempdirFactory's docstring.
2022-05-17 08:13:11 -03:00
Bruno Oliveira
a1ed6839e3 Refer to py.path.local instead of LEGACY_PATH constant for better docs 2022-05-17 08:09:21 -03:00
Bruno Oliveira
08c0eb661e Merge pull request #9968 from timhoffm/doc-reference-order 2022-05-17 07:55:06 -03:00
Bruno Oliveira
1feb857fcc Merge pull request #9967 from timhoffm/doc-fix-globaltoc 2022-05-17 07:53:53 -03:00
Ezio Melotti
296b642eb3 Fix rst markup in TempdirFactory's docstring. 2022-05-17 07:29:32 +02:00
Tim Hoffmann
ee10ecdf7e Reorder the reference guides in the docs
This changes the order to:

- API Reference
- Fixtures reference
- Configuration
- Exit codes
- Plugin List

which is approximately sorted from general to specific and often used to less used.
Plugin List ist at the end because it points to further external resources.
2022-05-16 23:01:54 +02:00
Tim Hoffmann
73c2d1c6e3 Remove "Python 2.7 and 3.4 Support" from globaltoc
Follow up to #9957 - I missed that the globaltoc is hard-coded
and the page needs to be removed there as well.
2022-05-16 22:52:27 +02:00
github-actions[bot]
7b977f4beb [automated] Update plugin list (#9959)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-05-16 08:46:51 -03:00
Tim Hoffmann
5d28a58640 Remove docs on Python 2.7 and 3.4 Support (#9957)
This extensive explanation is not need anymore because they are now
unsupported for a long time.

Instead add as short section on Python version compatibility in the
backward compatibility docs.
2022-05-16 10:17:18 +02:00
dependabot[bot]
5d20e28538 build(deps): Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.5.0 to 3.6.1.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.5.0...3.6.1)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-16 03:02:09 +00:00
Bruno Oliveira
cc0fbbefa0 Add CHANGELOG for #9873 (#9953) 2022-05-14 12:50:40 +02:00
sommersoft
56c266640e Do not truncate crash messages in short test summary on CI (#9933)
Closes #9920
2022-05-13 08:15:52 -03:00
Bruno Oliveira
69fb79e741 Add colors to summary (#9875)
Fix #9873
2022-05-12 09:55:40 -03:00
Bruno Oliveira
90d2adf0e8 Merge pull request #9951 from rcomer/document-subtest 2022-05-12 09:35:39 -03:00
Ruth Comer
c5432a18e7 doc: link to pytest-subtests 2022-05-12 12:20:00 +01:00
pre-commit-ci[bot]
16781f9b8c [pre-commit.ci] pre-commit autoupdate (#9936)
[pre-commit.ci] pre-commit autoupdate
2022-05-11 10:52:41 -03:00
Pax
a88c0f3bb0 Add link to python docs on logging levels (#9925) 2022-05-11 11:02:36 +03:00
Zac Hatfield-Dodds
ccdee08ddd Merge pull request #9911 from bkeyvani/fix-issue-8646 2022-05-10 23:53:40 -07:00
Zac Hatfield-Dodds
a29f4aff98 Update 8646.improvement.rst 2022-05-10 23:27:33 -07:00
Zac Hatfield-Dodds
58af76122f Move changelog file 2022-05-10 23:27:06 -07:00
Zac Hatfield-Dodds
29462b1277 type-ignore in error-message test 2022-05-10 23:24:13 -07:00
Bruno Oliveira
37316ed0de Merge pull request #9940 from timhoffm/doc-reference-cleanup 2022-05-10 17:21:32 -03:00
Tim Hoffmann
231e220635 Move documentation contents from reference.rst to docstrings
It's better to have the documentation in one place, instead
of having some in the docstring and some additional
information added to the reference documentation in
`reference.rst`.
2022-05-10 20:04:25 +02:00
Bruno Oliveira
93fdb3ecb7 Consistently add **Tutorial**: in front of how-to links in reference (#9938)
Up to now, some had the prefix, some didn't. I think it's good to have
this prefix to give more context, otherwise the links sometimes blend
into the description.

In one case, the link goes to an example, so I used `**Example**:` there.
2022-05-10 11:37:33 -03:00
Tim Hoffmann
a4a8763ebf Consistently add **Tutorial**: in front of how-to links in reference
Up to now, some had the prefix, some didn't. I think it's good to have
this prefix to give more context, otherwise the links sometimes blend
into the description.

In one case, the link goes to an example, so I used `**Example**:` there.
2022-05-10 16:27:21 +02:00
Babak Keyvani
31a9c5c667 improve pytest.raises - cont'd
a few more iterations on error message and related tests.
2022-05-09 21:15:02 -04:00
Ran Benita
db139307ce Merge pull request #9931 from bluetech/py11-rglob
testing: fix Path.rglob("") failures in Python 3.11b1
2022-05-09 16:15:36 +03:00
Ran Benita
644a81af37 testing: fix Path.rglob("") failures in Python 3.11b1
Fix #9930.
2022-05-09 12:52:57 +03:00
Ran Benita
f6aa9d661d Merge pull request #9926 from pytest-dev/update-plugin-list/patch-5f9d68c8d
[automated] Update plugin list
2022-05-09 11:33:32 +03:00
Ran Benita
933156b296 Merge pull request #9915 from peymanslh/fix-encoding-warning
Fix default encoding in cacheprovider
2022-05-09 11:33:05 +03:00
pytest bot
23c8f3d234 [automated] Update plugin list 2022-05-08 00:18:36 +00:00
MatthewFlamm
5f9d68c8d9 Clarify precision when using NUMBER option in --doctest-modules (#9914)
Fix #9892
2022-05-06 20:25:44 -03:00
Peyman Salehi
2f62e6ec96 Fix default encoding in cacheprovider 2022-05-03 20:56:46 +04:30
Anthony Sottile
4ddf48b0a3 Merge pull request #9912 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-05-03 11:17:47 -04:00
pre-commit-ci[bot]
f25b9f619b [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v3.0.1 → v3.1.0](https://github.com/asottile/reorder_python_imports/compare/v3.0.1...v3.1.0)
- [github.com/pre-commit/mirrors-mypy: v0.942 → v0.950](https://github.com/pre-commit/mirrors-mypy/compare/v0.942...v0.950)
2022-05-02 20:47:02 +00:00
Ran Benita
33bf91482e Merge pull request #9905 from pytest-dev/update-plugin-list/patch-e580534df
[automated] Update plugin list
2022-05-02 22:41:00 +03:00
Shantanu
2ba8fd5bc5 Re-export importlib.metadata from _pytest.compat (#9906)
I'm fixing a bug in mypy's --no-implicit-reexport logic in
https://github.com/python/mypy/pull/12704 and mypy-primer flagged this
2022-05-01 10:05:41 +03:00
pytest bot
306b33e755 [automated] Update plugin list 2022-05-01 00:24:20 +00:00
Babak Keyvani
3444d35c54 improve pytest.raises 2022-04-30 17:56:36 -06:00
johnkangw
97383d2d5d Mention use of re_assert for strings in approx docs 2022-04-30 17:20:31 -06:00
Florian Bruhin
e580534df0 doc: Reformat/Modernize some code (#9900)
Found because I was curious what https://pypi.org/project/shed/ does with pytest.
2022-04-28 16:30:16 +02:00
Jon Parise
f6db7ae749 Let mkdir() and mkpydir() receive PathLike names
These pytester utility methods were annotated to only receive `str`
names, but they naturally support os.PathLike values, as well.

This makes writing some pytester calls a little nicer, such as when
creating a directory based on a `.joinpath()` call. We previously needed
to cast that intermediate value to a `str`.
2022-04-25 17:21:15 -07:00
Bruno Oliveira
eb8b3ad929 Merge pull request #9885 from pytest-dev/update-plugin-list/patch-d949b3f7d
[automated] Update plugin list
2022-04-23 21:49:20 -03:00
pytest bot
21091a45d0 [automated] Update plugin list 2022-04-24 00:19:03 +00:00
Bruno Oliveira
d949b3f7d9 Merge pull request #9882 from nicoddemus/check-pick-release
Cherry-pick: 7.1.2 (#9881)
2022-04-23 11:51:08 -03:00
Bruno Oliveira
246815de13 Prepare release version 7.1.2 (#9881)
Co-authored-by: pytest bot <pytestbot@gmail.com>
(cherry picked from commit df9df55749)
2022-04-23 11:38:26 -03:00
Jon Parise
e598429c73 Use safe_getattr() in getfixturemarker() 2022-04-22 14:47:36 -07:00
Zac Hatfield-Dodds
0347957aa7 Fix wrong log_file docs (#9878)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-04-22 15:15:27 -03:00
Bruno Oliveira
1e8e46d456 Merge pull request #9823 from tobiasdiez/patch-1
Clarify error message in case no collectors are found for a file
2022-04-22 07:28:08 -03:00
Tobias Diez
7df405747a Merge branch 'pytest-dev:main' into patch-1 2022-04-22 12:11:03 +02:00
Zac Hatfield-Dodds
28e8c8582e Merge pull request #9871 from paulmueller/getpass-import-error
fix: move 'import getpass' statement to try-clause
2022-04-20 15:48:57 -07:00
Paul Müller
1285caadf2 Update 9871.bugfix.rst 2022-04-21 00:18:47 +02:00
pre-commit-ci[bot]
12971a37e1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-04-20 18:23:04 +00:00
Paul Müller
715d0ca9d0 cleanup 2022-04-20 20:21:44 +02:00
Paul Müller
2b9f8f2f9b Create 9871.bugfix.rst 2022-04-20 20:20:53 +02:00
pre-commit-ci[bot]
ac9b65d890 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-04-20 18:15:49 +00:00
Paul Müller
8514fab409 Update AUTHORS 2022-04-20 20:15:29 +02:00
Paul Müller
988197c795 fix: move 'import getpass' statement to try-clause 2022-04-20 20:09:37 +02:00
dependabot[bot]
1ea7081752 build(deps): Bump pytest-asyncio in /testing/plugins_integration (#9824)
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.18.2 to 0.18.3.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Changelog](https://github.com/pytest-dev/pytest-asyncio/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.18.2...v0.18.3)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-20 13:08:56 -03:00
github-actions[bot]
6a3168e770 [automated] Update plugin list (#9864)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-04-20 13:08:36 -03:00
Hugo van Kemenade
5800d39053 Increase stacklevel to point at user's code (#9869)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-04-20 13:07:10 -03:00
Bruno Oliveira
045dbc895d Merge pull request #9866 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-22.4.0
build(deps): Bump twisted from 22.2.0 to 22.4.0 in /testing/plugins_integration
2022-04-19 09:38:10 -03:00
Bruno Oliveira
a60a6a3fea Merge pull request #9865 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.0.4 2022-04-19 09:37:40 -03:00
Anthony Sottile
4e3ec26487 Merge pull request #9863 from gresm/patch-1
Update goodpractices.rst
2022-04-18 11:35:44 -04:00
dependabot[bot]
86b62067b7 build(deps): Bump twisted in /testing/plugins_integration
Bumps [twisted](https://github.com/twisted/twisted) from 22.2.0 to 22.4.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-22.2.0...twisted-22.4.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-18 03:01:59 +00:00
dependabot[bot]
ace71037ab build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.0.3 to 4.0.4.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.0.3...4.0.4)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-18 03:01:56 +00:00
Shantanu
2e8a319828 Use tomllib on Python 3.11 (#9741) 2022-04-17 21:11:17 +03:00
gresm
61095e4ba6 Update goodpractices.rst
Fix example package tree.
2022-04-16 15:51:21 +02:00
Bruno Oliveira
752a059cc2 Merge pull request #9854 from pytest-dev/docs-contributing-easy 2022-04-12 13:40:42 -03:00
Hugo van Kemenade
99e20713fd Docs: link to easy issues in contributing guide 2022-04-12 17:26:30 +03:00
Bruno Oliveira
26c62e1793 Merge pull request #9852 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-04-12 08:03:44 -03:00
pre-commit-ci[bot]
61dfdfcc3f [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.1.0 → v4.2.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.1.0...v4.2.0)
- [github.com/asottile/pyupgrade: v2.31.1 → v2.32.0](https://github.com/asottile/pyupgrade/compare/v2.31.1...v2.32.0)
2022-04-11 21:28:05 +00:00
Bruno Oliveira
9c2ee32069 Merge pull request #9849 from pytest-dev/update-plugin-list/patch-f0cf63a84
[automated] Update plugin list
2022-04-10 11:20:50 -03:00
pytest bot
765583dc34 [automated] Update plugin list 2022-04-10 00:17:14 +00:00
Anthony Sottile
f0cf63a84a Merge pull request #9842 from asottile/init-var-only-dataclasses
fix comparison of dataclasses with `InitVar`
2022-04-08 20:08:51 -04:00
Anthony Sottile
8fa775bcee fix comparison of dataclasses with InitVar 2022-04-08 19:51:05 -04:00
Bruno Oliveira
539a5d70f2 Merge pull request #9843 from asottile/sphinx-workaround 2022-04-08 20:33:40 -03:00
Anthony Sottile
1527130476 temporarily pin jinja2 version for docs build 2022-04-08 17:08:30 -04:00
Bruno Oliveira
238b25ffa9 Merge pull request #9826 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-04-05 09:07:39 -03:00
pre-commit-ci[bot]
e2269f8a5c [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 22.1.0 → 22.3.0](https://github.com/psf/black/compare/22.1.0...22.3.0)
- [github.com/asottile/setup-cfg-fmt: v1.20.0 → v1.20.1](https://github.com/asottile/setup-cfg-fmt/compare/v1.20.0...v1.20.1)
- [github.com/pre-commit/mirrors-mypy: v0.941 → v0.942](https://github.com/pre-commit/mirrors-mypy/compare/v0.941...v0.942)
2022-04-04 20:26:44 +00:00
Bruno Oliveira
16345bf689 Merge pull request #9832 from pytest-dev/update-plugin-list/patch-00ad12b9d
[automated] Update plugin list
2022-04-03 12:53:34 -03:00
pytest bot
79725c9102 [automated] Update plugin list 2022-04-03 00:17:36 +00:00
Tobias Diez
387ec02021 Add to AUTHORS 2022-03-29 12:38:34 +02:00
Tobias Diez
3fcdbaf0c5 Add changelog 2022-03-29 12:37:23 +02:00
Tobias Diez
141b301d3d Fix more tests 2022-03-29 12:34:15 +02:00
Tobias Diez
31595e8733 Fix tests 2022-03-29 12:33:13 +02:00
Tobias Diez
63c7338028 Fix rename issue 2022-03-27 16:56:23 +02:00
pre-commit-ci[bot]
0eae340e13 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-03-27 14:41:12 +00:00
Tobias Diez
1f10c59cd3 Clarify error message in case no collectors are found for a file 2022-03-27 16:30:57 +02:00
Bruno Oliveira
00ad12b9db Merge pull request #9821 from pytest-dev/update-plugin-list/patch-176d2d7b4
[automated] Update plugin list
2022-03-27 08:20:10 -03:00
pytest bot
592fee2263 [automated] Update plugin list 2022-03-27 00:19:03 +00:00
Anthony Sottile
176d2d7b4e Merge pull request #9806 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-03-23 21:00:02 -04:00
Ran Benita
05dcb22365 Merge pull request #9727 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-22.2.0
build(deps): Bump twisted from 22.1.0 to 22.2.0 in /testing/plugins_integration
2022-03-22 10:21:10 +02:00
dependabot[bot]
cccb9d8530 build(deps): Bump twisted in /testing/plugins_integration
Bumps [twisted](https://github.com/twisted/twisted) from 22.1.0 to 22.2.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/twisted-22.2.0/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-22.1.0...twisted-22.2.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-22 08:00:11 +00:00
pre-commit-ci[bot]
67ab712480 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.940 → v0.941](https://github.com/pre-commit/mirrors-mypy/compare/v0.940...v0.941)
2022-03-21 23:41:24 +00:00
Bruno Oliveira
250a0344ad Merge pull request #9804 from nicoddemus/311-cwd-tests 2022-03-21 13:11:51 -03:00
Bruno Oliveira
3c359455e2 Change directories during some tests in test_collection.py
As discussed in https://github.com/pytest-dev/pytest/pull/9800, this uses
monkeypatch to change directories for two tests in `test_collection.py`, to preserve
their original purpose (even if just removing it doesn't seem to affect the outcome).
2022-03-21 12:38:20 -03:00
Bruno Oliveira
d5ce9f5a16 Merge pull request #9800 from Zac-HD/fix-311-ci 2022-03-21 08:18:39 -03:00
Zac Hatfield-Dodds
0ebfa1d76d Fix CI for Python 3.11
Getting the current working directory has no side-effects, so these context managers were no-ops.
Discovered because Path.__enter__ is deprecated in Python 3.11, for removal in 3.13.
2022-03-20 21:01:26 -07:00
Ronny Pfannschmidt
e9dd3dffab Enhance errors for exception/warnings matching (#8508)
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2022-03-20 23:32:39 -03:00
Kian Eliasi
3297bb24a9 Remove unnecessary numpy import (#9798)
Fix #9726
2022-03-21 00:01:59 +00:00
Bruno Oliveira
6a6a32ceca Merge pull request #9796 from pytest-dev/update-plugin-list/patch-4b6b91fda
[automated] Update plugin list
2022-03-20 10:55:32 -03:00
pytest bot
e503faeb6e [automated] Update plugin list 2022-03-20 00:17:32 +00:00
Bruno Oliveira
4b6b91fda3 Merge pull request #9794 from nicoddemus/split-workflows 2022-03-19 09:34:45 -03:00
Bruno Oliveira
4c16b5af03 Split test/deploy workflows
This will trigger a deploy directly when a tag is pushed, avoiding
having to wait for another lenghty build.

This is safe since we only push release tags after the release PR has passed all its tests.

See comments in #9793.
2022-03-19 09:04:41 -03:00
Samuel Colvin
b75cbee290 Remove newlines from left/right operands with '-vv' (#9743)
The left/right operands produced when `verbose > 1` should not contain newlines, because they are used to 
build the `summary` string. The `assertrepr_compare` function returns a list of lines, and the summary is one of those lines and should not contain newlines itself. 

Fix #9742

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-03-19 11:55:39 +00:00
Ran Benita
eb22339dc3 Merge pull request #9786 from bluetech/cherry-pick-release
Merge pull request #9785 from pytest-dev/release-7.1.1
2022-03-19 13:44:10 +02:00
Bruno Oliveira
63126643b9 Merge pull request #9789 from spaceone/fix-typo 2022-03-18 18:57:52 -03:00
Florian Best
8f64a39d0a [style]: fix typo in docstring 2022-03-18 22:00:14 +01:00
Ran Benita
a18655f729 Merge pull request #9785 from pytest-dev/release-7.1.1
Prepare release 7.1.1

(cherry picked from commit b9462ed7d0)
2022-03-17 23:18:11 +02:00
Ran Benita
22756c28e5 Merge pull request #9768 from bluetech/fix-tests-verbose
testing: fix tests when run under `-v` or `-vv`
2022-03-17 18:17:17 +02:00
Ran Benita
f196701cc1 Merge pull request #9780 from bluetech/restore-confcutdir-behavior
config: restore pre-pytest 7.1.0 confcutdir exclusion behavior
2022-03-17 18:13:06 +02:00
Ran Benita
1d70b022f0 config: restore pre-pytest 7.1.0 confcutdir exclusion behavior
The change from `path not in confuctdir.parents` to the `relative_to`
check in 0c98f19231 broke picking up
conftest files when running against an installed package/site-packages.
See the issue for more details.

Fix #9767.
2022-03-16 22:55:06 +02:00
pre-commit-ci[bot]
d52a6e6074 [pre-commit.ci] pre-commit autoupdate (#9769)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/reorder_python_imports: v2.7.1 → v3.0.1](https://github.com/asottile/reorder_python_imports/compare/v2.7.1...v3.0.1)
- [github.com/asottile/pyupgrade: v2.31.0 → v2.31.1](https://github.com/asottile/pyupgrade/compare/v2.31.0...v2.31.1)
- [github.com/pre-commit/mirrors-mypy: v0.931 → v0.940](https://github.com/pre-commit/mirrors-mypy/compare/v0.931...v0.940)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix mypy errors

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-03-16 21:34:40 +02:00
Ran Benita
2bec21ef5f Merge pull request #9756 from ajberdy/main
Fixed typo in pytester docs.
2022-03-16 21:32:42 +02:00
Ran Benita
5c1756343f Merge pull request #9757 from pytest-dev/update-plugin-list/patch-d306ec0a7
[automated] Update plugin list
2022-03-16 21:32:11 +02:00
Ran Benita
a854ab97b9 Merge pull request #9766 from Rowin/pytest-warns-typo
Typo correction
2022-03-16 21:31:39 +02:00
pre-commit-ci[bot]
abfae83130 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-03-14 20:48:34 +00:00
Ran Benita
37fa0fb4d3 testing: fix tests when run under -v or -vv
Regressed in fac8f284cd, didn't notice
since we don't run tests in CI with `-v`.
2022-03-14 22:27:52 +02:00
Rowin
e75cdae2bc Typo correction
A word was missing in the docstring of the warns function.
2022-03-14 13:26:17 +01:00
Ran Benita
f0bf4c9681 Merge pull request #9760 from bluetech/cherry-pick-release
Merge pull request #9758 from pytest-dev/release-7.1.0
2022-03-13 17:20:13 +02:00
Ran Benita
d87e1e67dd Merge pull request #9758 from pytest-dev/release-7.1.0
Prepare release 7.1.0

(cherry picked from commit 7d4d1ecde6)
2022-03-13 16:59:20 +02:00
pytest bot
61f2b265a3 [automated] Update plugin list 2022-03-13 00:15:56 +00:00
Aaron Berdy
f3053017b9 fix typo in pytester docs 2022-03-12 14:44:52 -08:00
Florian Bruhin
d306ec0a7e Update upcoming trainings (#9744)
* Update upcoming trainings

* Remove old-ish link

* Revert "Remove old-ish link"

This reverts commit 30d75f5088.

* Use crossref

* Add past training
2022-03-12 16:51:56 +01:00
Bruno Oliveira
3e4c14bfaa Merge pull request #9751 from fabianegli/main 2022-03-11 09:53:30 -03:00
Fabian Egli
7f924b13a5 Fix typo in deprecation documentation 2022-03-11 11:15:28 +01:00
dependabot[bot]
4a8f8ada43 build(deps): Bump django from 4.0.2 to 4.0.3 in /testing/plugins_integration (#9737)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-07 13:50:25 +00:00
dependabot[bot]
c0fd2d8839 build(deps): Bump pytest-asyncio from 0.18.1 to 0.18.2 in /testing/plugins_integration (#9736)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-07 10:29:39 -03:00
Anthony Sottile
843e01824c Merge pull request #9732 from nicoddemus/9730-toml-failure
Improve error message for malformed pyproject.toml files
2022-03-06 10:01:13 -05:00
github-actions[bot]
bc43d66b47 [automated] Update plugin list (#9733)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-03-06 00:01:38 -03:00
Bruno Oliveira
e38d1cac48 Improve error message for malformed pyproject.toml files
Including the file name is enough to let the user know what the problem is.

The same is not needed for `.ini` files because the error message includes the path to the file by default.

Fix #9730
2022-03-05 08:59:28 -03:00
github-actions[bot]
cf0a4f79b0 [automated] Update plugin list (#9717)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-03-04 12:56:11 -03:00
Anthony Sottile
51b86b4dc4 Merge pull request #9714 from nicoddemus/pytester-request-monkeypatch-9708
pytester now requests monkeypatch instead of creating its own instance
2022-03-04 09:22:56 -05:00
Bruno Oliveira
f943d1944a pytester now requests monkeypatch instead of creating its own instance
It is tempting to use `monkeypatch` to replace the other mechanisms in pytester which change global
state: `CwdSnapshot`, `SysModulesSnapshot`, `SysPathsSnapshot`, however those are more delicate
than they look at first glance so leaving those alone for now.

Close #9708
2022-03-04 08:58:44 -05:00
Anthony Sottile
9318b2cb7f Merge pull request #9719 from asottile/fix-setuptools-pollution
prevent import-time side-effects from setuptools bundled importlib-metadata
2022-03-03 09:01:41 -05:00
Anthony Sottile
269611e0b4 prevent import-time side-effects from setuptools bundled importlib-metadata 2022-02-28 19:35:36 -05:00
Kojo Idrissa
e466a87bb0 Add the latest book edition of 'Python Testing with pytest' 2022-02-25 19:13:23 -03:00
Bruno Oliveira
5f3d94c47e Disallow unordered sequences in pytest.approx (#9709)
Fix #9692
2022-02-24 10:16:35 -03:00
Bruno Oliveira
bcc826d0fb Fix numbering and improve changelog entry for #9362 (#9713) 2022-02-23 19:03:13 -03:00
Ran Benita
4778e999a5 Merge pull request #9702 from m-tmatma/feature/fix-bash-complete
fix link of argcomplete page.
2022-02-23 19:30:40 +02:00
Ran Benita
7b6e477e2f Revert "Deprecate raising unittest.SkipTest to skip tests during collection" (#9710)
This reverts commit 25e657bfc1.

Turns out that this *is* a working unittest feature, which pytest should
support, so undo the deprecation.
2022-02-23 15:59:54 +02:00
github-actions[bot]
0c80a1c836 [automated] Update plugin list (#9701)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-02-23 08:26:18 -03:00
Masaru Tsuchiyama
7f50c521b6 fix link of argcomplete page. 2022-02-20 17:29:12 +09:00
Bruno Oliveira
9af3e23695 Expand warnings output for ResourceWarning (#9682)
Fix #9644
2022-02-15 13:00:50 +00:00
Ran Benita
bdbad91493 Merge pull request #9546 from bluetech/fixturedef-attr-doc
fixtures: document FixtureDef's attributes
2022-02-15 14:52:50 +02:00
Bruno Oliveira
fac8f284cd Fix diff output for data types where -v would show less information (#9661)
Close #5192
2022-02-15 09:43:20 -03:00
Ran Benita
afe41e5273 Merge pull request #9678 from bluetech/consistent-idval
python: unify code to generate ID from value
2022-02-15 13:23:35 +02:00
eduardo naufel schettino
c9cf2d4424 Fix count of selected tests on terminal collection summary (#9628) 2022-02-15 11:17:34 +00:00
Bruno Oliveira
f22451717d Merge pull request #9681 from nicoddemus/fix-9645-import-lib 2022-02-14 12:00:29 -03:00
Bruno Oliveira
04cf8db1d7 Merge pull request #9679 from pytest-dev/update-plugin-list/patch-c01a5c177
[automated] Update plugin list
2022-02-14 09:43:59 -03:00
Bruno Oliveira
747b8372ea Try to import module before creating dummy modules with 'importmode=importlib'
The dummy modules we introduce in `insert_missing_modules` (due to #7856 and #7859)
would cause problems if the dummy modules actually end up replacing modules
which could be imported normally because they are available in `PYTHONPATH`.

Now we attempt to first import the module via normal mechanisms, and only
introduce the dummy modules if the intermediary modules don't actually exist.

Close #9645
2022-02-14 09:42:05 -03:00
Andrew Svetlov
fc72ffa39e Merge pull request #9683 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-asyncio-0.18.1
build(deps): Bump pytest-asyncio from 0.17.2 to 0.18.1 in /testing/plugins_integration
2022-02-14 09:10:41 +02:00
dependabot[bot]
3e53307586 build(deps): Bump pytest-asyncio in /testing/plugins_integration
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.17.2 to 0.18.1.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.17.2...v0.18.1)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-14 03:02:17 +00:00
pytest bot
295e7535c9 [automated] Update plugin list 2022-02-13 00:15:13 +00:00
Ran Benita
c3aa4647c7 python: unify code to generate ID from value
In the following

    @pytest.mark.parametrize(..., ids=[val])

the ID values are only allowed to be `str`, `float`, `int` or `bool`.

In the following

    @pytest.mark.parametrize(..., [val])

    @pytest.mark.parametrize(..., [pytest.param(..., id=val])

a different code path is used, which also allows `bytes`, `complex`,
`re.Pattern`, `Enum` and anything with a `__name__`.

In the interest of consistency, use the latter code path for all cases.
2022-02-12 19:22:37 +02:00
Bruno Oliveira
c01a5c177b Merge pull request #9676 from nicoddemus/cherry-pick-release 2022-02-11 16:09:42 -03:00
Bruno Oliveira
68be319165 Merge pull request #9674 from pytest-dev/release-7.0.1
(cherry picked from commit 18d35b817d)
2022-02-11 15:52:00 -03:00
Bruno Oliveira
8afec9a64d Add autoflake to pre-commit configuration (#9666) 2022-02-11 14:34:02 -03:00
Bruno Oliveira
b79eff065e Enable testing with Python 3.11 (#9511) 2022-02-11 15:20:42 +00:00
Bruno Oliveira
6828ec2f9b Merge pull request #9669 from hugovk/ci-only-update-plugin-list-for-upstream 2022-02-11 09:24:09 -03:00
Bruno Oliveira
2a5bb3b4e0 Merge pull request #9668 from hugovk/test-me-latest-3.10 2022-02-11 09:15:14 -03:00
Hugo van Kemenade
eb8a3ef849 Only update the plugin for upstream 2022-02-11 14:03:22 +02:00
Hugo van Kemenade
be0c41bf8e CI: Test latest 3.10 available 2022-02-11 13:49:11 +02:00
Bruno Oliveira
9e922c4325 Merge pull request #9662 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-22.1.0 2022-02-11 07:28:32 -03:00
dependabot[bot]
2b12739412 build(deps): Bump twisted in /testing/plugins_integration
Bumps [twisted](https://github.com/twisted/twisted) from 21.7.0 to 22.1.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-21.7.0...twisted-22.1.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-11 03:47:43 +00:00
Bruno Oliveira
3586edc1c9 Merge pull request #9646 from nicoddemus/9643-delay-warning 2022-02-10 14:11:21 -03:00
Bruno Oliveira
88c35123b8 Delay warning about collector/item diamond inheritance
This allows that warning to be filtered by `filterwarnings`.

Fix #9643
2022-02-10 13:50:25 -03:00
Florian Bruhin
6aaa017b1e doc: Discourage squashing for release (#9657)
Fixes #9655
2022-02-10 08:58:20 +01:00
Ran Benita
2b6708b892 Merge pull request #9624 from bluetech/unittest-getobj
unittest: restore `UnitTestFunction.obj` to return unbound rather than bound method
2022-02-09 22:43:31 +02:00
Ran Benita
23bdf78654 Merge pull request #9651 from bluetech/rename-pythonpath
Rename ``pythonpath`` plugin to ``python_path``
2022-02-09 13:20:22 +02:00
Ran Benita
01e1de7a1a Rename `pythonpath plugin to python_path`
Fix #9636.
2022-02-09 10:03:20 +02:00
Ran Benita
04a6f52d67 Merge pull request #9611 from pllim/patch-1
DOC: pytest.warns() fails on zero warning
2022-02-08 16:00:06 +02:00
Ran Benita
4bf764f9a3 Merge pull request #9625 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.0.2
build(deps): Bump django from 4.0.1 to 4.0.2 in /testing/plugins_integration
2022-02-08 15:59:19 +02:00
Ran Benita
44290d1f6c Merge pull request #9609 from kdelee/patch-1
importlib.readers not valid until python 3.10
2022-02-08 15:57:48 +02:00
Ran Benita
fb378ea269 Merge pull request #9639 from bluetech/docs-django-https
doc: remove django intersphinx mapping
2022-02-08 15:57:06 +02:00
Anthony Sottile
c326c04494 Merge pull request #9642 from pytest-dev/run-testid-with-colon-colon
allow running testids which contain :: in the parametrized portion
2022-02-08 08:34:49 -05:00
Anthony Sottile
efa16c2c9d Merge pull request #9641 from asottile/fix-test-pollution-assertrewrite
fix test pollution in test_assertrewrite
2022-02-08 08:34:12 -05:00
Anthony Sottile
2442034a1e allow running testids which contain :: in the parametrized portion 2022-02-07 20:19:59 -05:00
Anthony Sottile
579785b6cd fix test pollution in test_assertrewrite
originally reproduced with this pollution set:

```
testing/test_assertrewrite.py::TestEarlyRewriteBailout::test_pattern_contains_subdirectories
testing/test_assertrewrite.py::TestRewriteOnImport::test_remember_rewritten_modules
```
2022-02-07 19:29:18 -05:00
Ran Benita
b80472c5bc doc: fix a reference 2022-02-08 00:53:17 +02:00
dependabot[bot]
ef7d67b665 build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.0.1...4.0.2)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-07 22:47:20 +00:00
Ran Benita
1612d3d1af doc: remove django intersphinx mapping
Initially I just wanted to fix http -> https, but I think it's not worth
having at all just for this one reference.
2022-02-08 00:46:20 +02:00
Ran Benita
d00ca3f8e5 unittest: restore UnitTestFunction.obj to return unbound rather than bound method
This fixes #9610.

pytest 7.0.0 (unintentionally) changed `UnitTestFunction.obj`'s' behavior
to match `Function.obj`. That is probably a good thing to have, however
it evidently causes some regressions as described in the issue, so
restore the previous behavior for now. In the future we might want to
make this change again, but with proper consideration.
2022-02-08 00:46:00 +02:00
pre-commit-ci[bot]
2073cce105 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-02-08 00:44:52 +02:00
Elijah DeLee
d45a19cfde move function specific imports to function
re: review from @asottile that this should only get imported in the function
modify the else/if logic since inside the function we already know the python version is >= 3.10, and just have to know if it is 3.11 or greater
2022-02-08 00:44:52 +02:00
Bruno Oliveira
f86a87a315 Update src/_pytest/assertion/rewrite.py
Co-authored-by: Ran Benita <ran@unusedvar.com>
2022-02-08 00:44:52 +02:00
Bruno Oliveira
66dc79efd4 Update changelog/9608.bugfix.rst
Co-authored-by: Elijah DeLee <kdelee@redhat.com>
2022-02-08 00:44:52 +02:00
Bruno Oliveira
5f1a2f33da Fix invalid importing of importlib.reader in Python 3.9
Fix #9608
2022-02-08 00:44:52 +02:00
Elijah DeLee
15ddccf700 importlib.readers not valid until python 3.10
This exists https://github.com/python/cpython/blob/3.10/Lib/importlib/readers.py and FileReader is in there
This is a 404 https://github.com/python/cpython/blob/3.9/Lib/importlib/readers.py

This change needs to get backported to the 7.0.z branch(s) too
Fixes https://github.com/pytest-dev/pytest/issues/9608
2022-02-08 00:44:52 +02:00
Anthony Sottile
bc33ba0be9 Merge pull request #9638 from asottile/fix-test-pollution
work around test pollution caused by new setuptools mutating global logger level
2022-02-07 17:19:01 -05:00
Anthony Sottile
b3692fe404 work around test pollution caused by new setuptools mutating global logger level 2022-02-07 15:10:03 -05:00
Ran Benita
6f936aa97c Merge pull request #9622 from pytest-dev/update-plugin-list/patch-18c0cfc0d
[automated] Update plugin list
2022-02-07 15:09:58 +02:00
pytest bot
2c3be75b09 [automated] Update plugin list 2022-02-06 00:13:55 +00:00
Ran Benita
18c0cfc0de Merge pull request #9612 from bluetech/namedtuple-class
mark/structures: use class-based NamedTuple syntax
2022-02-05 12:16:00 +02:00
Ran Benita
20c2c30ff2 mark/structures: use class-based NamedTuple syntax
Should hopefully work now in Python>=3.7.
2022-02-05 11:52:36 +02:00
P. L. Lim
d1b394af88 DOC: pytest.warns() fails on zero warning 2022-02-04 17:45:04 -05:00
Florian Bruhin
77a38a3b75 doc: Add changing RTD version to checklist (#9606)
I still think it makes sense to always serve docs from the release branch (rather than the latest tagged release), but that means we need to update it on new releases.
2022-02-04 17:36:31 +01:00
Gabor Szabo
57f8f5d2b3 Mention basetemp in docs as a way to only keep last temp dir (#9607)
Closes #9599
2022-02-04 12:38:26 +00:00
Florian Bruhin
b5a168aa0e doc: Streamline remote handling in releasing docs (#9603)
The docs already assume an 'upstream' remote, so we can only fetch from there instead of fetching all remotes. We also don't need to hardcode the remote URL.
2022-02-04 12:13:33 +01:00
Florian Bruhin
48f01bdcc2 doc: Hide done training (#9602)
Only commenting out as I expect to add trainings at PyConDE and possibly PyConIT soon
2022-02-04 12:12:58 +01:00
Florian Bruhin
dff1a15881 ci: Add missing macOS CI envs (#9601)
alinsa_vix in Discord noticed that we are not testing Python 3.9 and 3.10 on macOS, which seems strange. Maybe this is due how to macOS CI resources were quite scarce for a while, but I believe this has improved since.
2022-02-04 12:11:30 +01:00
Florian Bruhin
dfa7023862 Prepare release 7.0.0 (#9598) (#9604)
* Prepare release version 7.0.0

* Add note to changelog

Co-authored-by: pytest bot <pytestbot@gmail.com>
Co-authored-by: Florian Bruhin <me@the-compiler.org>
(cherry picked from commit e37fbe5685)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-02-04 07:48:24 -03:00
Florian Bruhin
2982753d80 releasing: Add template for major releases (#9596)
* releasing: Add template for major releases

With pytest 6.0.0, we still used a manual releasing workflow (at least if I
remember correctly), and apparently we never wrote a release announcement
template for major releases. Instead, the minor release template claimed that
the release would contain "breaking changes", which doesn't seem reasonable.
Thus, this adds a new major template based on the former minor template, and
adjusts the latter to only mention fixes and new features instead.

* Update scripts/release.minor.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-02-03 15:33:07 +00:00
Florian Bruhin
12b288d84a releasing: Always set doc_version (#9589)
Looks like something (tox?) does not deal with empty arguments being passed to release.py correctly
2022-02-03 11:48:55 +01:00
Anthony Sottile
90b1c93f7e Merge pull request #9585 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-02-01 01:32:31 -05:00
pre-commit-ci[bot]
9d2ffe207b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-01-31 22:20:16 +00:00
pre-commit-ci[bot]
3aef0b9de6 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.12b0 → 22.1.0](https://github.com/psf/black/compare/21.12b0...22.1.0)
- [github.com/asottile/blacken-docs: v1.12.0 → v1.12.1](https://github.com/asottile/blacken-docs/compare/v1.12.0...v1.12.1)
- [github.com/asottile/reorder_python_imports: v2.6.0 → v2.7.1](https://github.com/asottile/reorder_python_imports/compare/v2.6.0...v2.7.1)
2022-01-31 22:18:51 +00:00
Bruno Oliveira
4b1d9092a8 Merge pull request #9579 from pytest-dev/update-plugin-list/patch-ee9ddff34 2022-01-31 11:37:05 -03:00
Bruno Oliveira
232f44369a Merge pull request #9581 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-mock-3.7.0 2022-01-31 09:14:21 -03:00
dependabot[bot]
b2701a0272 build(deps): Bump pytest-mock in /testing/plugins_integration
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 3.6.1 to 3.7.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.6.1...v3.7.0)

---
updated-dependencies:
- dependency-name: pytest-mock
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-31 03:02:08 +00:00
pytest bot
321747628e [automated] Update plugin list 2022-01-30 00:12:51 +00:00
Florian Bruhin
ee9ddff34e doc: Recategorize 7.0.0 changelog items (#9561) 2022-01-27 12:39:32 +00:00
Florian Bruhin
6e1445b521 ci: Bump up timeout (#9560)
macOS apparently can be slow, https://github.com/pytest-dev/pytest/runs/4965510831 for #9556 got cancelled at 91%
2022-01-27 13:33:20 +01:00
Florian Bruhin
597bb9376b Add missing cooperative constructor changelog (#9559)
This was supposed to be part of #9488, but I only now noticed it was lying around uncommitted in my git dir
2022-01-27 13:33:09 +01:00
Florian Bruhin
843f03e3ca doc: Add ellipsis to warning usecase list (#9558)
I feel like this makes it clearer where the code which was inside 'pytest.warns' is supposed to go.
2022-01-27 13:32:37 +01:00
Bruno Oliveira
f064942f2e Make 'warnings' and 'deselected' in assert_outcomes optional (#9475)
Fix #9471
2022-01-27 12:18:36 +01:00
Florian Bruhin
396a7def75 Add additional docs for uncooperative ctor deprecation (#9498)
* Add additional docs for uncooperative ctor deprecation

Fixes #9488

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Break up long line

* Recommend kwonly args

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-27 11:49:18 +01:00
Ran Benita
cd8bfa94ec Merge pull request #9545 from bluetech/doc-version
doc/reference: don't document `pytest.__version__` under "Marks"
2022-01-27 10:46:28 +02:00
Ran Benita
04bddfc655 Merge pull request #9547 from bluetech/refactor-idmaker
Refactor idmaker functions into class IdMaker
2022-01-27 10:46:08 +02:00
Tobias Deiminger
b21b008118 Refactor idmaker functions into class IdMaker
This commit only refactors, it does not change or add functionality yet. Public
API is retained. Reason or refactoring:

User provided parameter IDs (e.g. Metafunc.parametrize(ids=...)) had so far
only been used to calculate a unique test ID for each test invocation. That
test ID was a joined string where each parameter contributed some partial ID.

We're soon going to reuse functionality to generate parameter keys for
reorder_items and FixtureDef cache. We will be interested in the partial
IDs, and only if they originate from explicit user information. Refactoring
makes logic and data accessible for reuse, and increases cohesion in general.
2022-01-26 15:42:34 +02:00
Ran Benita
acd2034535 fixtures: document FixtureDef's attributes 2022-01-25 23:44:59 +02:00
Ran Benita
52fbf3dbaa fixtures: make code flow clearer
Make the two cases (direct/indirect fixture) clearer. The try-catch
forces the reader to jump around.
2022-01-25 22:44:04 +02:00
Ran Benita
e6166ccc3c doc/reference: don't document pytest.__version__ under "Marks" 2022-01-25 22:39:13 +02:00
Ran Benita
5c69eced6c Merge pull request #9532 from bluetech/getdir-cache
config: avoid stat storm in _getconftestmodules
2022-01-25 16:21:44 +02:00
Akuli
a17e708352 With -vv, display the full skip/xfail reason instead of "..." (#9537)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-25 10:33:22 -03:00
Anthony Sottile
382e3d346e Merge pull request #9539 from pytest-dev/all-repos_autofix_flake8-typing-imports
upgrade flake8-typing-imports
2022-01-24 08:56:04 -05:00
Bruno Oliveira
2907252693 Merge pull request #9528 from SalmonMode/autouse-linearization-graph 2022-01-24 07:47:43 -03:00
Anthony Sottile
039c3a201d upgrade flake8-typing-imports
Committed via https://github.com/asottile/all-repos
2022-01-23 21:21:26 -05:00
Andrew Svetlov
b9fc678770 Merge pull request #9538 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-asyncio-0.17.2
build(deps): Bump pytest-asyncio from 0.16.0 to 0.17.2 in /testing/plugins_integration
2022-01-23 23:23:53 +02:00
Andrew Svetlov
9ae64aae56 Setup strict asyncio mode 2022-01-23 23:07:28 +02:00
dependabot[bot]
7783fb1b1e build(deps): Bump pytest-asyncio in /testing/plugins_integration
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.16.0 to 0.17.2.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.16.0...v0.17.2)

---
updated-dependencies:
- dependency-name: pytest-asyncio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-23 20:37:56 +00:00
Ran Benita
00085391fb Merge pull request #9518 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.5.0
build(deps): Bump anyio[curio,trio] from 3.4.0 to 3.5.0 in /testing/plugins_integration
2022-01-23 22:02:15 +02:00
Ran Benita
bc296443bd Merge pull request #9534 from pytest-dev/update-plugin-list/patch-bb5a4e2d6
[automated] Update plugin list
2022-01-23 21:46:43 +02:00
pytest bot
dddadefa68 [automated] Update plugin list 2022-01-23 00:12:46 +00:00
Ran Benita
aee04cd49f config: avoid stat storm in _getconftestmodules
Fix #9478.
2022-01-22 00:27:43 +02:00
Ran Benita
bb5a4e2d63 Merge pull request #9531 from bluetech/misc
python: fix confused docstring of `Metafunc._resolve_arg_ids`
2022-01-21 17:24:56 +02:00
Ran Benita
471634d6bd python: fix confused docstring of Metafunc._resolve_arg_ids
The docstring (and function name itself) described things as if IDs are
being assigned to the argnames, but actually they're assigned to the
parameter sets.
2022-01-21 16:18:44 +02:00
Ran Benita
888026f7a6 Merge pull request #9171 from bluetech/optimize-keywords-init
Optimizations/fixes around Function `keywords`
2022-01-21 15:19:53 +02:00
Ran Benita
6d128cd52e python: use a more memory-friendly generator 2022-01-21 14:35:25 +02:00
Ran Benita
74571ba55f Add missing keywords type annotations 2022-01-21 14:35:25 +02:00
Ran Benita
456a2538ac python: optimize node keywords initialization
If we do the `update`s in the right order, we can avoid the `mark.name
not in self.keywords` check, since `self.keywords` starts out clean and
`update` will override previously set keywords.
2022-01-21 14:35:25 +02:00
Ran Benita
3c69bc919c python: remove broken/ineffectual keywords marks initialization
By my analysis, this deleted code block has no effect:

1. `self.keywords` is `update`d with `callspec.marks`.
2. `self.own_markers` is `update`d with `callspec.marks`.
3. `self.keywords` is `update`d with `self.own_markers`.

So together steps 2+3 completely undo step 1.
2022-01-21 14:35:24 +02:00
Ran Benita
d9bcfa0c2b python: don't redundantly duplicate parent markers to own keywords
This does have a slight semantic change: in a node hierarchy parent ->
child, if parent has a marker applied, then child is constructed, then
`parent.themarker = "overridden"`, previously
`child.keywords['themarker']` would return `True`, now it returns
`"overridden"`. But that's actually what I would have expected so I see
it as more of a bugfix.
2022-01-21 14:34:27 +02:00
Ran Benita
8713c32462 python: unpacked marks need to be added to keywords on all node types
(except `Instance`)

Currently, `Function` does this manually, but other node types don't get
their markers added to their `keywords`, but they should, if only for
consistency.
2022-01-21 14:34:27 +02:00
Ran Benita
e9bb1aa233 python: be consistent with what value marks have in keywords
Marks are added to keywords in three places:

- `Node.add_marker`: name -> `Mark`
- `Function.__init__(callspec)`: name -> `Mark`
- `Function.__init__ iter_markers`: name -> True

I think it should be consistent, which will also help with some upcoming
code cleaning. The `Mark` seems more useful than just a `True`, so
switch to that.
2022-01-21 14:34:27 +02:00
Ran Benita
4e5fb520b6 python: remove an unneeded normalize_mark_list call
`callspec.mark` is already `List[Mark]` so no need to normalize it.
2022-01-21 14:34:27 +02:00
Ran Benita
6672a10354 fixtures: use node.ihook instead of open-coding it 2022-01-21 14:29:47 +02:00
Bruno Oliveira
4c8fb6f0af Merge pull request #9522 from holmanb/rewrite-test 2022-01-20 13:18:12 -03:00
Chris NeJame
1fd0dcd510 fix missing ref to flattened fixture order image 2022-01-19 09:26:07 -05:00
Brett Holman
3f44b4078c Add test coverage to test rewrite 2022-01-18 11:26:46 -07:00
dependabot[bot]
c393f95c99 build(deps): Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.4.0...3.5.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-17 03:02:30 +00:00
Bruno Oliveira
fe1f0e5376 Merge pull request #9516 from pytest-dev/update-plugin-list/patch-a6310c20c
[automated] Update plugin list
2022-01-16 09:03:31 -03:00
pytest bot
947b5dbc47 [automated] Update plugin list 2022-01-16 00:13:41 +00:00
Ran Benita
a6310c20c1 Merge pull request #9512 from bluetech/pluggy-private
testing: avoid private pluggy attributes in test
2022-01-14 18:09:10 +02:00
Ran Benita
3f4eab3f8f testing: avoid private pluggy attributes in test 2022-01-14 17:49:38 +02:00
Olga Matoula
2ad1b589af Add docs on pytest.warns(None) deprecation (#9495)
* Add docs on pytest.warns(None) deprecation

* Add new section for common warnings use cases

* Fix references for warnings use cases

* Fix reference link
2022-01-13 18:32:22 +00:00
Bruno Oliveira
e9ed4827a4 Merge pull request #9506 from eamanu/fix-9505 2022-01-13 13:52:09 -03:00
Emmanuel Arias
5c2d752e74 improve docs 2022-01-13 13:29:08 -03:00
Emmanuel Arias
0fe0b78a9f Improve on configuration file docs section
To avoid confusions the part of that "the configuration file can
be locate on your tests folder" is removed.
2022-01-13 12:52:18 -03:00
Ran Benita
f1aa7a25de Merge pull request #9493 from bluetech/conftesting
Some conftest changes
2022-01-12 10:38:14 +02:00
Anthony Sottile
202e44b5e6 Merge pull request #9500 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-01-10 18:33:35 -05:00
pre-commit-ci[bot]
8891d1f449 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.930 → v0.931](https://github.com/pre-commit/mirrors-mypy/compare/v0.930...v0.931)
2022-01-10 21:28:04 +00:00
Ran Benita
a425f15330 Merge pull request #9494 from bluetech/instance-property
python: add back `instance` accessor to all python nodes, not just Function
2022-01-10 21:08:46 +02:00
Bruno Oliveira
610edd156e Merge pull request #9497 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.0.1
build(deps): Bump django from 4.0 to 4.0.1 in /testing/plugins_integration
2022-01-10 07:58:56 -03:00
dependabot[bot]
0d5f52b127 build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 4.0 to 4.0.1.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/4.0...4.0.1)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-10 03:02:30 +00:00
Ran Benita
0995e84adb Merge pull request #9492 from pytest-dev/update-plugin-list/patch-abe2a8f4e
[automated] Update plugin list
2022-01-09 13:14:03 +02:00
Ran Benita
161bc48117 config: get rid of _conftestpath2mod
It duplicates what PluginManager already knows, and no longer needed now
that symlinks are not resolved (see previous commit).
2022-01-09 12:33:45 +02:00
Ran Benita
0ef882364e config: stop resolving symlinks in conftest paths
This became the wrong thing to do since
322190fd84.
2022-01-09 12:33:45 +02:00
Ran Benita
f08a77de77 python: add back instance accessor to all python nodes, not just Function
Regressed in 062d91ab4 (pytest 7.0.0rc1 only).

Fix #9486.
2022-01-09 12:14:46 +02:00
pytest bot
f0dab8ba8d [automated] Update plugin list 2022-01-09 00:12:59 +00:00
Ran Benita
d98b695fec config: return Sequence instead of List from _getconftestmodules
Nothing should mutate the internal data structure here.
2022-01-09 00:30:18 +02:00
Ran Benita
ed83efaf4b testing/test_monkeypatch: fix some patches leaking into pytest code
The tests patch `os.path.abspath` which can break some pytest internal
code since the patching is not undone immediately.
2022-01-09 00:13:40 +02:00
Ran Benita
0c98f19231 config: make confcutdir check a bit more clear & correct
I think this named function makes the code a bit easier to understand.

Also change the check to explicitly check for "is a sub-path of" instead
of the previous check which only worked assuming that path is within
confcutdir or a direct parent of it.
2022-01-08 22:48:40 +02:00
Ran Benita
1c7644cc7a config: some comments 2022-01-08 22:30:48 +02:00
Ran Benita
5f23157b39 config: remove always truthy condition 2022-01-08 12:36:43 +02:00
Ran Benita
abe2a8f4e1 Merge pull request #9484 from bluetech/getconftestmodules-cache-fix
config: fix incorrect cache hit check in _getconftestmodules
2022-01-07 13:27:45 +02:00
Ran Benita
b19374bc19 config: fix incorrect cache hit check in _getconftestmodules
This made the cache not work as intended, causing a major slowdown.

See #9478 for discussion and context.

Authored-by: Anthony Sottile <asottile@umich.edu>
2022-01-07 12:47:39 +02:00
Dan Alvizu
71baf24b6d Doc update: clarify -W syntax (#9464)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2022-01-04 13:55:01 +00:00
Bruno Oliveira
fa43b8dfb2 Merge pull request #9400 from nicoddemus/configinifile-9396 2022-01-04 10:22:35 -03:00
Bruno Oliveira
696f955ff8 Split wrappers and non-wrappers in test_load_initial_conftest_last_ordering
Seems better to test which one is which explicitly.
2022-01-04 10:03:30 -03:00
Bruno Oliveira
4038752bf3 Ensure Config.inifile is available during pytest_cmdline_main
Fix #9396
2022-01-04 10:03:28 -03:00
Anthony Sottile
1860140460 Merge pull request #9472 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-01-03 19:43:46 -05:00
pre-commit-ci[bot]
b6350b8b97 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.29.1 → v2.31.0](https://github.com/asottile/pyupgrade/compare/v2.29.1...v2.31.0)
2022-01-03 21:08:03 +00:00
github-actions[bot]
56081ca075 [automated] Update plugin list (#9468)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2022-01-03 18:57:32 +01:00
Florian Bruhin
d60771f986 ci: Try backporting via pull_request_target (#9430)
* ci: Try backporting via pull_request_target

* ci: Security improvements
2022-01-03 14:14:40 +00:00
Anthony Sottile
548cc4fc17 Merge pull request #9467 from hugovk/ci-rm-feature-branch-restriction
Remove branch restriction to allow testing feature branches
2022-01-01 18:29:14 -05:00
Hugo van Kemenade
819c67f58e Also test branches prefixed test-me- 2022-01-01 23:36:10 +02:00
Anthony Sottile
9a992df3c9 Merge pull request #9455 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-12-30 11:54:49 -05:00
Anthony Sottile
b0aabe4081 fix mypy 0.930 errors 2021-12-30 06:19:29 -08:00
pre-commit-ci[bot]
cbccc06302 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.1.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v4.1.0)
- [github.com/pre-commit/mirrors-mypy: v0.920 → v0.930](https://github.com/pre-commit/mirrors-mypy/compare/v0.920...v0.930)
2021-12-30 06:19:29 -08:00
Bruno Oliveira
3c8c0d2a33 Merge pull request #9461 from hugovk/main 2021-12-30 08:49:55 -03:00
Hugo van Kemenade
61417b2551 Drop support for EOL Python 3.6 2021-12-30 13:25:34 +02:00
Bruno Oliveira
325744ef86 Merge pull request #9460 from hugovk/rm-3.6 2021-12-30 08:18:44 -03:00
Hugo van Kemenade
1fd3601caa Drop support for EOL Python 3.6 2021-12-30 12:37:18 +02:00
Ran Benita
b9663fed6f Merge pull request #9442 from hramezani/drop_python_36
Drop Python3.6 in CI, setup.cfg, and readme.
2021-12-30 12:22:13 +02:00
Hasan Ramezani
0b7c3d1145 Remove Python 3.6 related warning from filterwarnings. 2021-12-28 17:09:27 +01:00
Ran Benita
79dbd19780 Merge pull request #9410 from pytest-dev/dependabot/pip/testing/plugins_integration/django-4.0
build(deps): Bump django from 3.2.10 to 4.0 in /testing/plugins_integration
2021-12-28 18:04:33 +02:00
dependabot[bot]
4eebfb2f19 build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.2.10 to 4.0.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.10...4.0)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-28 15:16:38 +00:00
Ran Benita
755e2509b6 Merge pull request #9456 from bluetech/tox-plugins-py
ci: run plugins job with python 3.9 instead of 3.7
2021-12-28 17:15:35 +02:00
Hasan Ramezani
e5bf3784a4 Update required Python version in docs. 2021-12-28 15:15:52 +01:00
Hasan Ramezani
b72ad0fa8e Remove has_flags conditions from src._pytest.assertion.rewrite._read_pyc 2021-12-28 10:11:45 +01:00
Hasan Ramezani
77042f77cc Remove breakpoint support checking since all python versions support it. 2021-12-28 10:11:45 +01:00
Hasan Ramezani
400915067f Move nullcontext import to src._pytest.logging. 2021-12-28 10:11:45 +01:00
Hasan Ramezani
3d7cd77017 Update syntax to Python3.7+. 2021-12-28 10:11:35 +01:00
Ran Benita
1522afa1cd ci: run plugins job with python 3.9 instead of 3.7
Latest Django release dropped support for 3.7.
2021-12-28 11:01:23 +02:00
Ran Benita
1131f23e04 Merge pull request #9451 from bluetech/code-path-changelog
doc: document {Code,TracebackEntry}.path changes as breaking
2021-12-27 16:59:42 +02:00
Ran Benita
0db1ff0d82 doc: document {Code,TracebackEntry}.path changes as breaking
Closes #9423.
2021-12-27 15:27:38 +02:00
Ran Benita
69da199f6e Merge pull request #9438 from bluetech/pytest-legacypath-imports
pytest: bring back direct imports of TempdirFactory, Testdir
2021-12-27 15:03:05 +02:00
Ran Benita
fcef7e49fd Merge pull request #9447 from bluetech/code-cut-pathlike
code: accept any `os.PathLike[str]` in `Traceback.cut`
2021-12-27 15:02:20 +02:00
Kian Meng, Ang
55debfad1f Fix typos (#9424) 2021-12-27 09:23:15 -03:00
Ran Benita
0da4760715 code: accept any os.PathLike[str] in Traceback.cut
Before 7.0.0rc1, the function accepted `Union[str, py.path.local]`, and
`py.path.local` compares equal to the string path, so a user was able to
pass the path as a string and it would work. In 7.0.0rc1 we changed the
`py.path.local` to `Path` which doesn't compare equal to the string
path, which breaks compatibility (e.g. the `sybil` package).

This restores compatibility for this function by accepting any
`os.PathLike[str]` and only comparing the string representations.
2021-12-27 11:26:32 +02:00
Ran Benita
7a42db2bf0 Merge pull request #9443 from bluetech/undocumented-hooks
doc/reference: add 4 missing hooks to reference
2021-12-27 11:11:56 +02:00
Ran Benita
7fc2cf51c2 Merge pull request #9441 from bluetech/nose-setup-callable
python: skip nose setup/teardown fixtures if non-callable
2021-12-27 11:09:51 +02:00
Hasan Ramezani
5599c5ad45 Drop Python3.6 in CI, setup.cfg, and readme. 2021-12-26 21:08:37 +01:00
Bruno Oliveira
09c0bee288 Merge pull request #9444 from pytest-dev/update-plugin-list/patch-443aa0219
[automated] Update plugin list
2021-12-26 14:10:28 -03:00
Anthony Sottile
d39780f30b Merge pull request #9428 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-12-26 11:50:46 -05:00
pytest bot
427f035b76 [automated] Update plugin list 2021-12-26 00:14:18 +00:00
Ran Benita
05d46ca850 doc/reference: add 4 missing hooks to reference
Fix #9434.
2021-12-25 13:54:42 +02:00
Ran Benita
3128080806 pytest: bring back direct imports of TempdirFactory, Testdir
The monkeypatch approach doesn't work for `import pytest;
pytest.TempdirFactory`.

Fix #9432.
2021-12-25 13:27:02 +02:00
Ran Benita
10e21dadee python: skip nose setup/teardown fixtures if non-callable
Since commit 89f0b5b5a2 cases as in the
added test started to fail, like they do for the standard pytest names
(`setup_module` etc). But the name `setup` in particular is way too
common for us to start taking it over more aggressively, so restore the
previous behavior which required the object to be callable.

Fix #9391.
2021-12-25 12:09:11 +02:00
Ran Benita
443aa0219c Merge pull request #9416 from bluetech/doc-stash-fix
doc: fix a reference in "Writing hook functions"
2021-12-25 10:49:40 +02:00
Ran Benita
8071ad6b90 doc: fix a reference in "Writing hook functions" 2021-12-25 10:30:59 +02:00
Ran Benita
0fecfff2be Merge pull request #9425 from pytest-dev/update-plugin-list/patch-47df71d23
[automated] Update plugin list
2021-12-23 11:07:22 +02:00
Anthony Sottile
c69b84f236 fix typing issues in mypy 0.920 2021-12-21 20:42:32 -05:00
pre-commit-ci[bot]
e358bc65a8 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.910-1 → v0.920](https://github.com/pre-commit/mirrors-mypy/compare/v0.910-1...v0.920)
2021-12-20 20:42:31 +00:00
pytest bot
a73a9a12a2 [automated] Update plugin list 2021-12-19 00:12:37 +00:00
Bruno Oliveira
47df71d23f Merge pull request #9417 from nicoddemus/fix-py3.10.1-9413 2021-12-16 10:37:52 -03:00
Bruno Oliveira
913439f5e5 Fix test_errors_in_xfail_skip_expressions for Python 3.10.1
Decided to remove the condition altogether as seems reasonable to state
that our own test suite requires Python 3.10.1.

Fix #9413
2021-12-16 10:18:07 -03:00
Yuval Shimon
3bbadda0cf Merge pull request #9407 from yuvalshi0/remove-eq-format
Avoid specialized assert formatting when we detect that __eq__ is overridden
2021-12-14 10:53:56 +02:00
Bruno Oliveira
d8ff487b07 Merge pull request #9411 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.5.2 2021-12-13 08:54:31 -03:00
dependabot[bot]
a3cf2ad3bc build(deps): Bump pytest-django in /testing/plugins_integration
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.5.1 to 4.5.2.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.5.1...v4.5.2)

---
updated-dependencies:
- dependency-name: pytest-django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-13 03:02:33 +00:00
Ran Benita
8040cfd965 Merge pull request #9401 from bluetech/doc-hooks-ref
doc: add a `hook` crossref type
2021-12-12 18:02:53 +02:00
Ran Benita
ab8c9848a0 Merge pull request #9408 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.2.10
build(deps): Bump django from 3.2.9 to 3.2.10 in /testing/plugins_integration
2021-12-12 18:02:27 +02:00
Ran Benita
0e69c62ece doc: add a hook crossref type
Allow writing

    🪝`pytest_cmdline_main`

instead of

    :func:`pytest_cmdline_main <_pytest.hookspec.pytest_cmdline_main>`
2021-12-12 16:29:30 +02:00
dependabot[bot]
4d6e8a310b build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.2.9 to 3.2.10.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.9...3.2.10)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-12 14:26:36 +00:00
Ran Benita
37d44434d8 Merge pull request #9405 from bluetech/ci-backport
ci: add a workflow for backporting to other branches
2021-12-12 16:26:11 +02:00
Bruno Oliveira
0bc77de158 Merge pull request #9406 from pytest-dev/update-plugin-list/patch-dd609e150
[automated] Update plugin list
2021-12-12 11:22:11 -03:00
Yuval Shimon
0ea039db60 adding auto_detect=true test 2021-12-12 16:11:33 +02:00
Yuval Shimon
0c45065040 removing coverage on eq method 2021-12-12 15:39:30 +02:00
Yuval Shimon
7cf2b51d8e Merge branch 'pytest-dev:main' into remove-eq-format 2021-12-12 15:16:58 +02:00
Yuval Shimon
2d7905b13b support pypy 2021-12-12 15:14:24 +02:00
Yuval Shimon
df74e5c532 fixing pre-commit 2021-12-12 14:53:29 +02:00
pre-commit-ci[bot]
9166ff6cb5 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-12-12 12:49:24 +00:00
Yuval Shimon
8c3b17263b removing unnecessary changes 2021-12-12 14:47:00 +02:00
Yuval Shimon
a67c547536 fixing tests 2021-12-12 14:45:47 +02:00
Yuval Shimon
31f42ef83f small fix 2021-12-12 14:40:46 +02:00
Yuval Shimon
897395afd5 fix 9326 2021-12-12 14:38:45 +02:00
pytest bot
99a8be200a [automated] Update plugin list 2021-12-12 00:12:01 +00:00
Ran Benita
c85b14391d ci: add a workflow for backporting to other branches
To backport a PR, e.g. 1000, to another branch, e.g. `7.0.x`, add a
label `backport 7.0.x` to the PR. This will trigger a workflow which
will create a branch `backport-1000-to-7.0.x` based on the `7.0.x`
branch with a cherry-pick of the PR's merge commit, and create a new PR
for it against the `7.0.x` branch.

It is very simplistic, for instance it doesn't handle cherry-pick
failure gracefully, doesn't validate the state of the PR, doesn't check
if the branch already exists, etc. But we can improve on it later as
needed.

Finally, PRs created by github actions do not themselves trigger further
actions, i.e. the PR isn't checked. You need to close & reopen the PR
for the checks to trigger. There are workarounds for this but they are
either less secure or require more setup.
2021-12-12 01:12:35 +02:00
Ran Benita
dd609e150b Merge pull request #9264 from bluetech/no-pycollector
Make PyCollector an implementation detail - don't use in hook type annotation
2021-12-11 22:57:49 +02:00
Ran Benita
0c8a54ab77 Merge pull request #9310 from bluetech/test-main-same-mod
testing/test_session: add a regression test for an old bug
2021-12-11 22:26:28 +02:00
Ran Benita
c7be96dae4 Merge pull request #9392 from bluetech/rm-7-deprecated
Remove deprecations scheduled for removal in pytest 7.1
2021-12-08 22:59:42 +02:00
Ran Benita
ee93557ef3 Remove PytestRemovedIn7Warning
Fix #8838.
2021-12-08 15:58:08 +02:00
Ran Benita
e05e696fda Make PyCollector an implementation detail - don't use in hook type annotation
The `pytest_pycollector_makeitem` argument `collector` is currently
annotated with type `PyCollector`. As part of #7469, that would have
required us to expose it in the public API. But really it's an
implementation detail, not something we want to expose. So replace the
annotation with the concrete python collector types that are passed.

Strictly speaking, `pytest_pycollector_makeitem` is called from
`PyCollector.collect()`, so the new type annotation is incorrect if
another type subclasses `PyCollector`. But the set of python collectors
is closed (mapping to language constructs), and the type is private, so
there shouldn't be any other deriving classes, and we can consider it
effectively sealed (unfortunately Python does not provide a way to
express this - yet?).
2021-12-08 15:20:23 +02:00
Anthony Sottile
7ae23ff8ae fix python version in changelog message (#9390) 2021-12-08 10:46:55 +01:00
Bruno Oliveira
3ba9c01f9b Hide internal stack when using pytest.approx() in bool context (#9394)
This makes the error traceback point directly to the offending usage, rather
than to the internal `Approx.__bool__` method.
2021-12-08 10:46:44 +01:00
Ran Benita
0f39f11d88 Remove deprecated pytest.collect module 2021-12-07 22:27:35 +02:00
Ran Benita
4a45a5e983 Remove deprecated -k foobar: syntax 2021-12-07 22:27:35 +02:00
Ran Benita
927d9d274f Remove deprecated -k -foobar syntax 2021-12-07 22:27:35 +02:00
Ran Benita
41d8fb09ca Remove deprecated pytest_warning_captured hook 2021-12-07 22:27:35 +02:00
Ran Benita
0b0e2d2dbb Remove deprecated _fillfuncargs function 2021-12-07 22:27:35 +02:00
Ran Benita
4d7a962ca0 Merge pull request #9389 from merwok/patch-1
fix markup typo that breaks rendering
2021-12-07 18:35:42 +02:00
Éric
b691d31897 fix typo 2021-12-07 18:16:59 +02:00
Ran Benita
d4120738b5 Merge pull request #9387 from pytest-dev/releasing-prerelease-tag
RELEASING: should also tag dev0 for prereleases
2021-12-07 17:16:16 +02:00
Ran Benita
49278c1df8 RELEASING: should also tag dev0 for prereleases 2021-12-07 15:04:27 +02:00
Florian Bruhin
21a186bbda scripts: Use release branch for changelog URL (#9380)
* scripts: Use release branch for changelog URL

With a prerelease, /stable won't show the correct changelog.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-07 10:24:57 +00:00
Florian Bruhin
5cb50fa13c Fix changelog URL in 7.0.0rc1 announcement (#9379)
The changelog does not exist at /stable because an rc isn't stable...
2021-12-07 10:04:55 +00:00
Yuval Shimon
dc7091502d Fixed error message prints function decorators when using assert in Python 3.9 and above. (#9359) 2021-12-07 11:31:03 +02:00
Ran Benita
ef76c28ea2 Merge pull request #9374 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-12-07 11:20:28 +02:00
Florian Bruhin
0ad452bcba Prepare release version 7.0.0rc1 (#9375) (#9377)
Co-authored-by: pytest bot <pytestbot@gmail.com>
(cherry picked from commit 85897eddc6)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-12-07 10:13:36 +01:00
Florian Bruhin
fbf64d2529 Don't thank pytest bot (#9372) 2021-12-06 22:55:18 +01:00
Florian Bruhin
3a479db126 Fix hook param name in nonpython example (#9373)
Follow up to #9363
2021-12-06 22:55:06 +01:00
pre-commit-ci[bot]
dd53cc7e38 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-12-06 21:12:33 +00:00
pre-commit-ci[bot]
d7e7c32a5f [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.11b1 → 21.12b0](https://github.com/psf/black/compare/21.11b1...21.12b0)
2021-12-06 21:10:55 +00:00
Bruno Oliveira
70d3d0f390 Drop readline workaround introduced in #1281 (#8848)
Fix #8733
Closes #8847
2021-12-06 19:50:11 +01:00
Florian Bruhin
b3ed595f52 Revert "Fix Dead link in README for 'assert statements' " (#9369)
This reverts commit 15989ddc8f.

Reverts #8945, thus reintroducing #8926 temporarily, but we should be close to
the 7.0.0 release now, where this is the correct URL to use.

Closes #8831 as follow-up to #8858.
2021-12-06 17:56:39 +00:00
Ran Benita
5c55e91d77 Merge pull request #9368 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.5.1
build(deps): Bump pytest-django from 4.4.0 to 4.5.1 in /testing/plugins_integration
2021-12-06 15:39:37 +02:00
Florian Bruhin
663be09723 Improve reference and path/fspath docs (#9341)
* Improve reference and path/fspath docs

Closes #9283

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixups

* Add explanation

* Update wording after #9363

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-06 11:25:05 +01:00
dependabot[bot]
17e2ecb253 build(deps): Bump pytest-django in /testing/plugins_integration
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django) from 4.4.0 to 4.5.1.
- [Release notes](https://github.com/pytest-dev/pytest-django/releases)
- [Changelog](https://github.com/pytest-dev/pytest-django/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pytest-dev/pytest-django/compare/v4.4.0...v4.5.1)

---
updated-dependencies:
- dependency-name: pytest-django
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-06 03:02:03 +00:00
Bruno Oliveira
5852d66a6a Merge pull request #9367 from pytest-dev/update-plugin-list/patch-a335ade1f
[automated] Update plugin list
2021-12-05 11:13:37 -03:00
pytest bot
72b7334f1d [automated] Update plugin list 2021-12-05 00:12:43 +00:00
Bruno Oliveira
a335ade1f5 Rename pathlib hook parameters (#9363)
* Rename pytest_ignore_collect fspath parameter to collection_path

* Rename pytest_collect_file fspath parameter to file_path

* Rename pytest_pycollect_makemodule fspath parameter to module_path

* Rename pytest_report_header startpath parameter to start_path

* Rename pytest_report_collectionfinish startpath parameter to start_path

* Update docs with the renamed parameters

* Use pytest-flakes fork temporarily to prove it works

* Use pytest-flakes 4.0.5
2021-12-03 13:14:09 +01:00
Bruno Oliveira
96366dca42 Merge pull request #9356 from nicoddemus/copyright 2021-12-02 07:37:16 -03:00
Bruno Oliveira
482b858675 Merge pull request #9357 from GergelyKalmar/remove-unnecessary-newline 2021-12-01 19:08:46 -03:00
GergelyKalmar
82d450f98e Update authors 2021-11-30 19:04:00 +01:00
GergelyKalmar
1bcc2f87a2 Do not display empty worker info 2021-11-30 18:59:46 +01:00
Bruno Oliveira
ed24f29e60 Change copyright notice so yearly updates are not needed
Just learned that we don't need to do this every year: https://hynek.me/til/copyright-years

Followed Go's example of only stating the starting year: https://github.com/golang/go/blob/master/LICENSE

Btw any ideas why the dates vary? Some start in 2004, others 2013, 2015... shouldn't be the same year for all locations?
2021-11-30 09:28:23 -03:00
Zac Hatfield-Dodds
e2ee3144ed Merge pull request #9352 from truth-quark/spelling_fix_9351 2021-11-30 22:47:35 +11:00
Ben Davies
86bcaad828 Fix output of example test method. 2021-11-30 14:55:05 +11:00
Bruno Oliveira
fa240b0bb4 Merge pull request #9345 from aminalaee/patch-1 2021-11-29 11:43:53 -03:00
Bruno Oliveira
7627a7b413 Merge pull request #9348 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.4.0
build(deps): Bump anyio[curio,trio] from 3.3.4 to 3.4.0 in /testing/plugins_integration
2021-11-29 11:32:07 -03:00
dependabot[bot]
a0a37adfb2 build(deps): Bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.3.4 to 3.4.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.3.4...3.4.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-29 03:02:13 +00:00
Ran Benita
64f22dcb80 Merge pull request #9346 from pytest-dev/update-plugin-list/patch-e01231c21
[automated] Update plugin list
2021-11-28 15:25:05 +02:00
pytest bot
7de752a50b [automated] Update plugin list 2021-11-28 00:12:22 +00:00
Amin Alaee
f0d5d523aa Update .readthedocs.yml 2021-11-27 13:15:16 +01:00
Bruno Oliveira
e01231c215 Merge pull request #9332 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-11-26 11:02:59 -03:00
Florian Bruhin
8436d695e5 Fix doc issues in deprecation change (#9336)
Follow-up to #9309.

The issue in the changelog broke the docs build with:

doc/en/_changelog_towncrier_draft.rst:47: WARNING: Inline literal start-string
without end-string.

The second change isn't as critical, but caused the text to be rendered as
monospace including the tilde (i.e. `~pytest.PytestDeprecationwarning`).
2021-11-25 09:43:23 +01:00
pre-commit-ci[bot]
372a6fdfd7 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.10b0 → 21.11b1](https://github.com/psf/black/compare/21.10b0...21.11b1)
- [github.com/asottile/blacken-docs: v1.11.0 → v1.12.0](https://github.com/asottile/blacken-docs/compare/v1.11.0...v1.12.0)
- [github.com/asottile/pyupgrade: v2.29.0 → v2.29.1](https://github.com/asottile/pyupgrade/compare/v2.29.0...v2.29.1)
- [github.com/asottile/setup-cfg-fmt: v1.19.0 → v1.20.0](https://github.com/asottile/setup-cfg-fmt/compare/v1.19.0...v1.20.0)
2021-11-22 20:52:15 +00:00
Ran Benita
df9e94fbca Change deprecation warnings into errors for 7.0 release, using a new mechanism (#9309) 2021-11-21 17:13:44 +02:00
github-actions[bot]
4fd897a631 [automated] Update plugin list (#9326)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2021-11-21 17:12:22 +02:00
Bruno Oliveira
cd49075ad7 Merge pull request #9319 from nicoddemus/skip-test-prefix-integration-3.9 2021-11-19 12:23:34 -03:00
Bruno Oliveira
bd897513f2 Skip TestPyCacheDir.test_sys_pycache_prefix_integration on Windows + Python 3.9
Related to #9298
2021-11-19 11:22:08 -03:00
Ran Benita
43213add57 testing/test_session: add a regression test for an old bug
Nothing tests this currently. Make sure it doesn't regress if/when the
complex code in `Session.collect` is cleaned up.
2021-11-15 23:22:54 +02:00
Ran Benita
a172a4141b Change PytestRemovedIn7Warning to error by default
Per our backward compatibility policy.

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-11-14 23:57:10 +02:00
Ran Benita
128f29ee35 Categorize deprecation warnings to PytestRemovedInXWarning
Closes #7480.

This allows us to more easily follow our deprecation policy of turning
warnings into errors for the X.0 releases before complete removal in
X.1.

It also makes the deprecation timeline clear to both the users and
pytest developers -- it can be hard to keep track.

Note that the designation is not meant to be a binding contract - if the
time comes for removal of a specific deprecation but we decide it's too
soon, can just bump it to the next major.

Inspired by Django:
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/submitting-patches/#deprecating-a-feature
2021-11-14 23:57:10 +02:00
Bruno Oliveira
3dc17f1c3b Merge pull request #9293 from hoefling/doc/extlinks-gh-user 2021-11-13 10:57:37 -03:00
Ran Benita
062d91ab47 python: remove the Instance collector node 2021-11-13 14:03:44 +02:00
Florian Bruhin
17b38259fd Pin towncrier to 19.9.0 (#9282)
See https://github.com/twisted/towncrier/issues/346
Closes #8817, supersedes #9045 and #9046.
2021-11-11 16:48:54 +01:00
Bruno Oliveira
c5ab30d907 Merge pull request #9294 from spagh-eddie/patch-1 2021-11-11 07:33:21 -03:00
Eddie
a76df875c7 Remove space inside of dotted attribute 2021-11-10 12:54:21 -08:00
oleg.hoefling
2f1096cd55 replace hardcoded links to github user profiles with extlinks
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-11-10 20:47:27 +01:00
Florian Bruhin
5d87a27434 Elide pytest-internal paths for --fixtures (#9281)
* Elide pytest-internal paths for --fixtures

Fixes #8822

* Make flake8 happy
2021-11-10 15:16:41 +01:00
Florian Bruhin
f9afcd2d8a More pytest 7 changelog fixes (#9285)
* Remove changelog entry for #8251

Reverted in #8903

* Move #9202 changelog to to trivial

This won't concern users of pytest

* Streamline deprecation changelogs/docs

* Remove #8994 changelog

This is an impovement for a warning introduced in this release, so including it in a changelog against the last release seems confusing.

* Remove #9241 changelog

This is an impovement for a doc update introduced in this release, so including it in a changelog against the last release seems confusing. The issue number also seems about something different.

* Remove #8897 changelog

Empty file...

* Various minor changelog fixes
2021-11-10 15:16:24 +01:00
Ran Benita
d6e6b9696d Merge pull request #9286 from bluetech/legacypath-subplugins
legacypath: support late-loading of pytester plugin
2021-11-09 15:05:15 +02:00
Ran Benita
63899c76a4 legacypath: support late-loading of pytester plugin
Fixes #9280.

Previous approach didn't support pytester being loaded using
`pytest_plugins = "pytester"` in a conftest.
2021-11-08 21:56:40 +02:00
Ran Benita
f87df9c52e nodes: keep plugins which subclass Item, File working for a bit more (#9279)
* nodes: keep plugins which subclass Item, File working for a bit more

Fix #8435.

* Update src/_pytest/nodes.py

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

Co-authored-by: Florian Bruhin <me@the-compiler.org>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-11-08 14:51:04 +00:00
Simon K
eb6c4493b2 Deprecation of msg= for both pytest.skip() and pytest.fail(). (#8950)
* porting pytest.skip() to use reason=, adding tests

* avoid adding **kwargs, it breaks other functionality, use optional msg= instead

* deprecation of `pytest.fail(msg=...)`

* fix bug with not capturing the returned reason value

* pass reason= in acceptance async tests instead of msg=

* finalising deprecations of `msg` in `pytest.skip()` and `pytest.fail()`

* Update doc/en/deprecations.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

* Update doc/en/deprecations.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

* fix failing test after upstream merge

* adding deprecation to `pytest.exit(msg=...)`

* add docs for pytest.exit deprecations

* finalising deprecation of msg for pytest.skip, pytest.exit and pytest.fail

* hold a reference to the Scope instance to please mypy

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-11-08 15:31:14 +01:00
Bruno Oliveira
b7603fa730 Merge pull request #9278 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.2.9 2021-11-08 10:13:19 -03:00
Bruno Oliveira
b378f9a6e0 Merge pull request #9276 from hoefling/doc/extlinks-bpo 2021-11-08 09:41:26 -03:00
Bruno Oliveira
13d23a2dd5 Merge pull request #9275 from hoefling/doc/extlinks-gh-pull 2021-11-08 09:39:50 -03:00
Thomas Hisch
59373fe402 Merge pull request #9271 from thisch/unpack
Inline PercentStyleMultiline._update_message
2021-11-08 12:54:44 +01:00
dependabot[bot]
ff9e51c171 build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.2.8 to 3.2.9.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.8...3.2.9)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-08 03:01:45 +00:00
Ran Benita
86446edc86 Merge pull request #9273 from bluetech/nose-fixtures2
nose: fix class- and module-level fixture behavior
2021-11-07 23:14:39 +02:00
github-actions[bot]
2792f9184e [automated] Update plugin list (#9274)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2021-11-07 23:12:57 +02:00
oleg.hoefling
16e15b99ae sphinx 3 compat
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-11-07 15:24:57 +01:00
oleg.hoefling
36265ccbf6 replace hardcoded links to bugs.python.org with extlinks
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-11-07 15:24:57 +01:00
oleg.hoefling
bba0ce4877 replace hardcoded links to github pull requests with extlinks
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-11-07 15:18:36 +01:00
Simon K
7037a58711 use list comp for getreports in terminal py (#9243) 2021-11-06 16:32:37 +00:00
Ran Benita
89f0b5b5a2 nose: fix class- and module-level fixture behavior
Fixes #9272.

Fixing the issue directly in the plugin is somewhat hard, so do it in
core. Since the plugin is going to be deprecated, I figure it's OK to
cheat a bit.
2021-11-06 14:45:24 +02:00
Oleg Höfling
49f934618c Replace hardcoded links to Github issues with extlinks (#9234) 2021-11-06 11:16:11 +02:00
Thomas Hisch
d8b647970f Inline PercentStyleMultiline._update_message
and take advantage of dict unpacking operator.
2021-11-05 23:08:30 +01:00
Ran Benita
842814c969 Merge pull request #9262 from bluetech/export-reports
Export CollectReport and TestReport
2021-11-03 15:17:22 +02:00
Ran Benita
b0aa870b11 Export CollectReport and TestReport
Refs #7469.
2021-11-02 20:58:51 +02:00
Ran Benita
a53abe93d8 Merge pull request #9208 from bluetech/legacypath-plugin
Add legacypath plugin, move py.path stuff there
2021-11-02 20:35:12 +02:00
Bruno Oliveira
e1b3c2da4b Merge pull request #9256 from pytest-dev/pre-commit-ci-update-config 2021-11-01 19:15:31 -03:00
pre-commit-ci[bot]
2fa37f677b [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.9b0 → 21.10b0](https://github.com/psf/black/compare/21.9b0...21.10b0)
- [github.com/asottile/setup-cfg-fmt: v1.18.0 → v1.19.0](https://github.com/asottile/setup-cfg-fmt/compare/v1.18.0...v1.19.0)
2021-11-01 20:26:52 +00:00
Harshna
9d17cebe64 Use correct input arg type for _bestrelpath (#9238)
Closes #8990
2021-11-01 17:43:05 +02:00
Cristian Vera
f288afde1d Use codecov github action instead of deprecated bash uploader (#9252)
Fixes #9202.
2021-11-01 17:41:56 +02:00
denivyruck
0191563fd6 DoctTest line numbers not found due to method wrapping (#8861)
Closes #8796
2021-11-01 09:01:25 +02:00
Ran Benita
1de5c07b95 Merge pull request #9255 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-bdd-5.0.0
build(deps): Bump pytest-bdd from 4.1.0 to 5.0.0 in /testing/plugins_integration
2021-11-01 08:58:37 +02:00
Alexander King
31c207a0b5 Support forwardslash characters in identifiers (#9249)
Closes #8377.
2021-11-01 08:54:18 +02:00
Ran Benita
11bb9205d7 [automated] Update plugin list (#9253)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2021-11-01 08:42:35 +02:00
dependabot[bot]
8932970a68 build(deps): Bump pytest-bdd in /testing/plugins_integration
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 4.1.0 to 5.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/4.1.0...5.0.0)

---
updated-dependencies:
- dependency-name: pytest-bdd
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 03:01:28 +00:00
pytest bot
81e2d46302 [automated] Update plugin list 2021-10-31 00:11:03 +00:00
andrewdotn
1824349f74 Use Ubuntu 20.04, lualatex for readthedocs builds (#9242) 2021-10-30 11:21:14 -03:00
Ran Benita
69b0a7b306 ci: remove linting job - covered be pre-commit.ci (#9247) 2021-10-29 19:23:47 -03:00
Ran Benita
e6eac28f0e legacypath: only add testdir and tmpdir fixtures if corresponding plugins are registered
This preserves the existing behavior and gives a proper error message
in case e.g. `testdir` is requested without the `pytester` plugin being
loaded.
2021-10-29 13:11:12 +03:00
Ran Benita
c3dff755af Move Node.fspath to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita
ce7cff9f8e Move pathlist support to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita
d9ca55c648 Move Session.startdir to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita
84722a7904 Move Config.{invocation_dir,rootdir,inifile} to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita
d979f82fb0 Move TerminalReporter.stardir to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita
7c0011374c Move FixtureRequest.fspath to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita
a1a605a63e Move Cache.makedir to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita
5e883f5195 Move tmpdir to legacypath plugin 2021-10-28 21:51:51 +03:00
Ran Benita
1df28a4450 Move testdir to legacypath plugin 2021-10-28 21:51:51 +03:00
andrewdotn
bcad6e8e9a Make plugin list in PDF docs readable (#9241)
The current PDF docs attempt to format the list of all plugins as a
table, without any word-wrapping of the plugin description. That results
in almost all the information getting cut off. This PR formats the same
information into more of a paragraph format for the PDF, with nothing
cut off.

Fixes #451
2021-10-28 11:31:52 +03:00
Ran Benita
c2ece58aa0 Add legacypath plugin 2021-10-27 09:31:44 +03:00
Ran Benita
b7fc0003fd Merge pull request #9232 from bluetech/deprecate-node-fspath-args
Deprecate Node constuctor fspath argument, and other small changes/fixes
2021-10-27 09:26:57 +03:00
Ran Benita
7706fd6840 nodes: deprecate fspath arguments to node constructors
This is unfortunately a dependency on `py.path` which cannot be moved to
an external plugins or eased in any way, so has to be deprecated in
order for pytest to be able to eventually remove the dependency on `py`.
2021-10-27 08:36:10 +03:00
Ran Benita
99363ad7ff recwarn: fix was -> were in DID NOT WARN message 2021-10-27 08:36:10 +03:00
Ran Benita
3c5c5feb04 Merge pull request #9230 from bluetech/pytester-transitive-public
Export pytester transitive types
2021-10-27 08:05:08 +03:00
Alexander King
14e032088c Change the command for package building in release CI workflow (#9229) 2021-10-25 21:32:12 +03:00
Ran Benita
89f8ff5a6d Merge pull request #9233 from pytest-dev/update-plugin-list/patch-f695e18dd
[automated] Update plugin list
2021-10-25 21:05:55 +03:00
pytest bot
2f0e1cd230 [automated] Update plugin list 2021-10-24 00:11:06 +00:00
Ran Benita
60ca83746b docs: change references to 6.3 -> 7.0
The plans have changed, next version will be 7.0 not 6.3.
2021-10-23 22:49:55 +03:00
Ran Benita
755ce9bc80 hookspec: improve legacy path deprecation docs 2021-10-23 22:49:54 +03:00
Ran Benita
afc7442e22 nodes: inline _imply_path
Only one usage left, and we certainly don't expect more!

Rename `_imply_path_only` to `_imply_path`, that's a less confusing name
now.
2021-10-23 22:10:08 +03:00
Ran Benita
6be3f31dba nodes: remove redundent _imply_path call
The Node ctor will take care of the check.
2021-10-23 21:34:16 +03:00
Ran Benita
853b0a4c29 nodes: fix bug in Node() fspath compat
Since path <-> fspath are converted to each other, we need to check both
before looking at the parent, in case fspath is set but path is not.
2021-10-23 21:33:12 +03:00
Ran Benita
11e36c8493 Make transitive Pytester types public
Export `HookRecorder`, `RecordedHookCall` (originally `ParsedCall`),
`RunResult`, `LineMatcher`.

These types are reachable through `Pytester` and so should be public
themselves for typing and other purposes.

The name `ParsedCall` I think is too generic under the `pytest`
namespace, so rename it to `RecordedHookCall`.

The `HookRecorder`'s constructor is made private -- it should only be
constructed by `Pytester`.

`LineMatcher` and `RunResult` are exported as is - no private and no
rename, since they're being used.

All of the classes are made final as they are not designed for
subclassing.
2021-10-23 10:59:18 +03:00
Ran Benita
259cff59f5 Remove {pytester,testdir}.Session aliases
This causes `Session` documentation to be rendered again in full under
`pytester` and `testdir` in the API Reference. I tried but couldn't get
sphinx to hide it.

Since it's a pretty odd thing to have (should just use
`pytest.Session`), and I couldn't find any plugin which uses this, let's
just remove it.
2021-10-23 10:25:29 +03:00
Ran Benita
f695e18ddb Merge pull request #9227 from bluetech/config-_cleanup
Use public API for adding config cleanup
2021-10-22 22:50:55 +03:00
Alexander King
005690bd67 Add template for prereleases (#9165)
Fix #8820
2021-10-22 10:00:00 -03:00
Oleg Höfling
1e9e16d829 Replace hardcoded links to PyPI with extlinks (#9224) 2021-10-22 09:47:57 -03:00
Ran Benita
5fd182f3de Use public API for adding config cleanup
No need to spuriously access the private internals of Config.
2021-10-22 11:03:27 +03:00
Ran Benita
2af41c5703 Merge pull request #9226 from bluetech/doc-setup-py
doc: modernize discussion of setup.py in "Good Integration Practices"
2021-10-22 11:01:10 +03:00
Ran Benita
7314b32b63 doc: modernize discussion of setup.py in "Good Integration Practices" 2021-10-22 10:24:39 +03:00
Bruno Oliveira
61e506a63f Merge pull request #9223 from nicoddemus/better-filter-warnings-messages 2021-10-21 22:45:00 -03:00
Bruno Oliveira
f5fd2fb176 Improve UX during errors while parsing warning filters
Fix #7864
Fix #9218

Closes #8343
Closes #7877
2021-10-21 13:15:41 -03:00
Bruno Oliveira
4a3834101e Merge pull request #9209 from pytest-dev/update-plugin-list/patch-0696d3eda
[automated] Update plugin list
2021-10-19 06:53:25 -03:00
Bruno Oliveira
20a69e11aa Merge pull request #9214 from nicoddemus/confcutdir-9210 2021-10-19 06:52:52 -03:00
Bruno Oliveira
c000955dde Remove incorrect docs about confcutdir being a config option
Fix #9210
2021-10-18 19:20:27 -03:00
dependabot[bot]
080fc81971 build(deps): Bump pytest-asyncio from 0.15.1 to 0.16.0 in /testing/plugins_integration (#9212)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-18 19:16:55 -03:00
dependabot[bot]
73fb797bbd build(deps): Bump anyio[curio,trio] from 3.3.3 to 3.3.4 in /testing/plugins_integration (#9211)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-18 19:16:16 -03:00
Cristian Vera
cbcfeca78c Cache.set preserves key order when saving dicts (#9206)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-10-18 19:15:34 -03:00
pytest bot
3cc0c451e7 [automated] Update plugin list 2021-10-17 00:11:56 +00:00
Ran Benita
0696d3eda1 Merge pull request #9207 from bluetech/rm-py-pre
Remove some `py` uses
2021-10-16 22:26:45 +03:00
Ran Benita
a3b69d9d83 Remove py version printing, traceback filtering, freezing
Not so important anymore, and makes it easier to remove the py
dependency.
2021-10-16 12:01:31 +03:00
Ran Benita
bc2f20722c testing: remove a few redundant py references 2021-10-16 11:58:35 +03:00
Bruno Oliveira
5fc7b21391 Use xelatex engine for better Unicode support (#9197) 2021-10-12 10:12:15 -03:00
pre-commit-ci[bot]
d7752b4d1e [pre-commit.ci] pre-commit autoupdate (#9191)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-10-11 20:09:25 +00:00
dependabot[bot]
110d70ec88 build(deps): bump django from 3.2.7 to 3.2.8 in /testing/plugins_integration (#9190)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-10-11 12:44:28 +00:00
James Myatt
ccd3874d7a Recommend not integrating with setuptools (#9185) 2021-10-11 15:28:27 +03:00
dependabot[bot]
d0cc45d723 build(deps): bump anyio[curio,trio] from 3.3.2 to 3.3.3 in /testing/plugins_integration (#9189)
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.3.2 to 3.3.3.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.3.2...3.3.3)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-10-11 09:25:51 -03:00
Ran Benita
da3b3012b1 Merge pull request #9184 from bluetech/reportinfo-pathlike
[7.0] Change `Node.reportinfo()` return value from `py.path` to `str|os.PathLike[str]`
2021-10-11 14:33:03 +03:00
github-actions[bot]
4b417ac38e [automated] Update plugin list (#9186)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2021-10-10 12:00:43 -03:00
Ran Benita
14a879b6d1 Merge pull request #9183 from bluetech/rm-redundent-osfspath
Remove redundant explicit os.fspath calls
2021-10-09 19:14:55 +03:00
Bernát Gábor
3407fe63e2 Support the importlib.resources files API in rewritten files (#9173) 2021-10-09 10:54:44 -03:00
Ran Benita
7eee5c1634 Change Node.reportinfo() return value from py.path to str|os.PathLike[str]
`reportinfo()` is the last remaining py.path-only code path in pytest,
i.e. the last piece holding back py.path deprecation. The problem with
it is that plugins/users use it from both sides -- implementing it
(returning the value) and using it (using the return value). Dealing
with implementers is easy enough -- allow to return `os.PathLike[str]`.
But for callers who expect strictly `py.path` this will break and
there's not really a good way to provide backward compat for this.

From analyzing a corpus of 680 pytest plugins, the vast majority of
`reportinfo` appearances are implementations, and the few callers don't
actually access the path part of the return tuple.

As for test suites that might access `reportinfo` (e.g. using
`request.node.reportinfo()` or other ways), that is much harder to
survey, but from the ones I searched, I only found case
(`pytest_teamcity`, but even then it uses `str(fspath)` so is unlikely
to be affected in practice). They are better served with using
`node.location` or `node.path` directly.

Therefore, just break it and change the return type to
`str|os.PathLike[str]`.

Refs #7259.
2021-10-09 15:02:03 +03:00
Ran Benita
5059b31a73 Remove redundant explicit os.fspath calls
Python calls it on its own.
2021-10-09 13:44:44 +03:00
Jeff Rasley
e84ba80301 Update pastebin URL from bpaste to bpa.st (#9131) 2021-10-06 08:12:48 -03:00
Ran Benita
e077f1cbd5 Merge pull request #9168 from bluetech/node-keywords-dups
mark/structures: fix NodeKeywords.{__iter__,__len__} given duplicates
2021-10-06 12:01:05 +03:00
Ran Benita
cf4495ffe1 mark/structures: fix NodeKeywords.{__iter__,__len__} given duplicates
Regressed in c4b9b14a4 -- the `set` stuff had a reason which I had
missed.
2021-10-06 11:24:28 +03:00
Ran Benita
c9267af3bf Merge pull request #9166 from bluetech/optimize-imply-path
nodes: micro-optimize _imply_path
2021-10-06 10:50:10 +03:00
Ran Benita
076ac901bb nodes: micro-optimize _imply_path 2021-10-06 10:29:52 +03:00
Bruno Oliveira
14b79a66a3 Merge pull request #9025 from davidszotten/more_verbose_for_ci 2021-10-05 16:52:47 -03:00
Bruno Oliveira
9546fb713a Merge pull request #9066 from eamanu/fix-8994 2021-10-05 16:52:08 -03:00
Bruno Oliveira
fb52fc5163 Merge pull request #9070 from andrewdotn/main 2021-10-05 16:51:58 -03:00
Bruno Oliveira
459e10b802 Merge pull request #9133 from okken/9113_deselected_assert_outcomes 2021-10-05 16:50:42 -03:00
Ran Benita
d0bdc26490 Merge pull request #9164 from bluetech/optimize-keywords
mark/structures: micro-optimize item.keywords/NodeKeywords
2021-10-05 20:03:42 +03:00
Ran Benita
c4b9b14a44 mark/structures: micro-optimize item.keywords/NodeKeywords 2021-10-05 16:50:22 +03:00
Ran Benita
54811b24e2 Merge pull request #9163 from bluetech/rewrite-end-lineno
rewrite: fixup end_lineno, end_col_offset of rewritten asserts
2021-10-05 16:46:29 +03:00
Ran Benita
6a5211f369 rewrite: fixup end_lineno, end_col_offset of rewritten asserts
These are new additions in Python 3.8:
https://docs.python.org/3/whatsnew/3.8.html#ast
I'm not sure what's using them but we should set them anyway.
2021-10-05 10:51:09 +03:00
Brian Okken
c82bda259c Add a pythonpath setting to allow paths to be added to sys.path. (#9134) 2021-10-05 09:36:38 +03:00
Bruno Oliveira
05a97375fd Merge pull request #9162 from pytest-dev/pre-commit-ci-update-config 2021-10-04 18:55:29 -03:00
Zac Hatfield-Dodds
e763fde482 Merge pull request #9158 from hoefling/doc/internal-crossrefs
replace hardcoded urls to docs.pytest.org with internal crossrefs, add crossrefs to numpy docs, use sphinx pep role
2021-10-05 08:43:19 +11:00
pre-commit-ci[bot]
1a8b4343ff [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.28.0 → v2.29.0](https://github.com/asottile/pyupgrade/compare/v2.28.0...v2.29.0)
2021-10-04 19:49:14 +00:00
Ran Benita
483f239d01 Merge pull request #9161 from bluetech/attrs-auto
Use attr.s(auto_attribs=True) in more places
2021-10-04 21:59:52 +03:00
oleg.hoefling
3926526c95 revert changes in doc/en/announce
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-10-04 20:06:13 +02:00
Ronny Pfannschmidt
028eb6fab6 Merge pull request #9115 from RonnyPfannschmidt/fix-regendoc
fix #8818 - run regendoc without tox cachedir
2021-10-04 19:11:45 +02:00
Ran Benita
e5468681b0 Use attr.s(auto_attribs=True) in more places
It's nicer to read without the attr.ib noise.
2021-10-04 19:24:12 +03:00
Ran Benita
dced00e60f Merge pull request #9154 from bluetech/refactor-callspec2
python: refactor CallSpec2
2021-10-04 18:56:29 +03:00
Ran Benita
570b1facb7 python: refactor CallSpec2
This type is semi-private; not documented but many plugins access it
through `item.callspec`. However, plugins access the public fields and
almost none try to construct or monkeypatch it. So we should be allowed
to clean it up some.

- Convert to attrs, add slots and frozen

- Instead of doing `new = old.copy(); new.setmulti2()`, do `new =
  old.setmulti()`. This is cleaner and faster.

- Remove the `metafunc` attribute. This causes a reference cycle
  (multifunc._calls -> callspec -> multifunc) for no good reason --
  neither pytest itself or plugins access this attribute, so let's not
  keep the Metafunc objects alive past their due.

- Some comments.

I would have also like to make the dicts and lists themselves immutable,
however some plugins mess with those so that should be done separately,
if at all.
2021-10-04 17:33:52 +03:00
Bruno Oliveira
c4557c3192 Merge pull request #9150 from nicoddemus/issue-9141-fixture-docs 2021-10-04 09:48:19 -03:00
Ran Benita
8a58b0c892 Merge pull request #9155 from pytest-dev/update-plugin-list/patch-0fbfd1ca3
[automated] Update plugin list
2021-10-04 10:46:16 +03:00
Ran Benita
73634ffb49 Merge pull request #9160 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-cov-3.0.0
build(deps): bump pytest-cov from 2.12.1 to 3.0.0 in /testing/plugins_integration
2021-10-04 10:45:21 +03:00
Ronny Pfannschmidt
c21ef7ba22 fix #8818 - run regendoc without tox cachedir
#4270 introduced per tox env pytest cachedirs and
never protected regendoc against it
2021-10-04 08:56:26 +02:00
dependabot[bot]
c061412a8b build(deps): bump pytest-cov in /testing/plugins_integration
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.12.1 to 3.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.12.1...v3.0.0)

---
updated-dependencies:
- dependency-name: pytest-cov
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-04 03:01:33 +00:00
oleg.hoefling
d58ee2b677 replace hardcoded urls to docs.pytest.org with internal crossrefs, add external crossrefs where possible
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-10-04 00:23:41 +02:00
Ronny Pfannschmidt
35d8c1398c Merge pull request #8134 from RonnyPfannschmidt/setuptools_scm_5
fixes #8133: migrate to setuptools_scm 6.x
2021-10-03 20:46:00 +02:00
pytest bot
618ee0f268 [automated] Update plugin list 2021-10-03 00:11:19 +00:00
Ronny Pfannschmidt
0892c77bc6 fixes #8133: mitigate regendoc issues wrt PRETEND_VERSION
this issues is less likely to hit due to the recent regendoc release
which includes a wheel

* migrate to setuptools_scm 6.3.2
* use SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST
2021-10-02 20:22:18 +02:00
Ran Benita
0fbfd1ca36 Merge pull request #9152 from bluetech/mark-optimize
mark/structures: slightly optimize some functions
2021-10-02 15:57:57 +03:00
Ran Benita
2cfce8d8c4 Merge pull request #9153 from bluetech/coverage-assert-never
coverage: add assert_never to exclude_lines
2021-10-02 15:56:24 +03:00
Ran Benita
1d0261e5cb coverage: add assert_never to exclude_lines
These are assertions that should never trigger.
2021-10-02 14:26:04 +03:00
Ran Benita
637e8efdd4 mark/structures: slightly optimize some functions
`normalize_mark_list` shows up in pandas collection profiles. It's
simple enough to improve.
2021-10-02 14:06:52 +03:00
Bruno Oliveira
ac3614b999 Add note about fixture teardown and SIGTERM and SIGQUIT signals
Close #9141
2021-10-01 16:12:03 -03:00
pre-commit-ci[bot]
bb6155adfa [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-10-01 16:07:39 +00:00
Vijay Arora
5fefd7de96 Updated indentation and spaces in logging.py for #9146 2021-10-01 21:36:35 +05:30
Vijay Arora
750ce30392 Update 9146.doc.rst 2021-10-01 21:33:32 +05:30
pre-commit-ci[bot]
de1f378b60 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-10-01 14:53:26 +00:00
Vijay Arora
14d5b4ca6c Merge pull request #2 from Vijay-Arora/Vijay-Arora-patch-1
Updated AUTHORS and added changelog file
2021-10-01 20:19:23 +05:30
Vijay Arora
307dbf15c4 Add Myself as Authors 2021-10-01 20:16:10 +05:30
Vijay Arora
a8697601ad Create 9146.doc.rst
Create 9146.doc.rst
2021-10-01 20:10:46 +05:30
Vijay Arora
0ed1b0ac12 Merge pull request #1 from Vijay-Arora/Vijay-Arora-patch-1
Updated logging.py for #9146
2021-10-01 20:04:51 +05:30
Vijay Arora
26b0702b98 Updated logging.py
Updated logging.py for #9146
2021-10-01 19:34:59 +05:30
Ran Benita
f65dfc39f3 Merge pull request #9123 from pytest-dev/update-plugin-list/patch-112204cf8
[automated] Update plugin list
2021-10-01 16:31:59 +03:00
Ran Benita
8af558723e main: avoid Path(Path(...)) calls, they're slow (#9147) 2021-10-01 16:21:32 +03:00
Ran Benita
5fc3e35afb Merge pull request #9144 from bluetech/py36_order_by_definition
py36+ tests are definition ordered [v2]
2021-10-01 16:17:37 +03:00
Ran Benita
d8831c64eb Merge pull request #9148 from bluetech/lru-cache-method
Avoid `@lru_cache` on methods
2021-10-01 16:16:51 +03:00
Ran Benita
3a6eaa9c1c Merge pull request #9145 from bluetech/compat-pattern
compat: replace REGEX_TYPE with typing.Pattern
2021-10-01 16:16:28 +03:00
Ran Benita
c86ceb4d01 main: avoid Path(Path(...)) calls, they're slow 2021-10-01 15:30:03 +03:00
Ran Benita
16e5fbe371 config: optimize PytestPluginManager._getconftestmodules
Now that it's no longer using `@lru_cache`, use another check to avoid
re-computation. Although `@lru_cache` is faster than the full function
call + checks, this approach also has the advantage that the caching
works for more than 128 entries.
2021-10-01 15:25:28 +03:00
Ran Benita
614f5394b5 Avoid @lru_cache on methods
The problem with `@lru_cache` on methods is that it also captures `self`
and leaks it until the entry is evicted (if ever).
2021-10-01 14:41:14 +03:00
Ran Benita
1f938e3ef5 compat: replace REGEX_TYPE with typing.Pattern
Since Python 3.7, there is `re.Pattern` for this, but since we need to
support Python 3.6, can use `typing.Pattern` which works as well.
2021-10-01 14:00:15 +03:00
Ran Benita
631c8b4df2 Merge pull request #9143 from bluetech/docs-stash-typo
Fix syntax typo in writing_hook_functions.rst
2021-10-01 11:38:15 +03:00
Ran Benita
4b13b5993e Fix syntax typo in writing_hook_functions.rst 2021-10-01 10:26:56 +03:00
Brian Okken
6d6cfd839a Add a deselected parameter to assert_outcomes() 2021-09-29 07:22:53 -07:00
Bruno Oliveira
7720154ca0 Merge pull request #9129 from nicoddemus/fix-linting-main
Fix formatting
2021-09-27 23:46:18 -03:00
Bruno Oliveira
7f5e49e70b Fix formatting 2021-09-27 22:51:08 -03:00
Bruno Oliveira
dd6d4b2fe0 Merge pull request #9128 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-09-27 20:37:57 -03:00
pre-commit-ci[bot]
56fda99fa1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-09-27 19:47:18 +00:00
pre-commit-ci[bot]
70858ac266 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.26.0 → v2.28.0](https://github.com/asottile/pyupgrade/compare/v2.26.0...v2.28.0)
2021-09-27 19:44:12 +00:00
Bruno Oliveira
e3efbd4b39 Merge pull request #9127 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-rerunfailures-10.2
build(deps): bump pytest-rerunfailures from 10.1 to 10.2 in /testing/plugins_integration
2021-09-27 08:13:15 -03:00
Bruno Oliveira
bbd5d55e98 Merge pull request #9126 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.3.2
build(deps): bump anyio[curio,trio] from 3.3.1 to 3.3.2 in /testing/plugins_integration
2021-09-27 08:12:57 -03:00
dependabot[bot]
222fdd4a58 build(deps): bump pytest-rerunfailures in /testing/plugins_integration
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 10.1 to 10.2.
- [Release notes](https://github.com/pytest-dev/pytest-rerunfailures/releases)
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/10.1...10.2)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-27 03:02:31 +00:00
dependabot[bot]
442abeafd0 build(deps): bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.3.1...3.3.2)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-27 03:02:27 +00:00
pytest bot
4a016db7b4 [automated] Update plugin list 2021-09-26 00:11:24 +00:00
Florian Bruhin
112204cf8d Fix non-sensical error message (#9077)
* Fix non-sensical error message

Introduced in 12de92cd2b / #7698

* Add a test

* Put the unit back into unittest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-09-24 06:15:53 +02:00
Ran Benita
037d2903be Merge pull request #9112 from bluetech/plugin-list-escape
scripts/update-plugin-list: escape summary for special RST chars
2021-09-22 17:00:07 +03:00
pre-commit-ci[bot]
24b347507a [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-09-22 13:41:33 +00:00
Ran Benita
4ae4bec968 scripts/update-plugin-list: escape summary for special RST chars
A new plugin has this summary:

    Continiously runs pytest on changes in *.py files

The `*` is interpreted as a special character and fails the CI.

Add some rudimentary escaping to hopefully prevent this.
2021-09-22 16:39:15 +03:00
Bruno Oliveira
bec42f7b0b Merge pull request #9092 from nicoddemus/cleanup-projects-page 2021-09-22 10:28:45 -03:00
Ran Benita
3f404418bf Merge pull request #9088 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.3.1
build(deps): bump anyio[curio,trio] from 3.3.0 to 3.3.1 in /testing/plugins_integration
2021-09-22 15:56:28 +03:00
Ran Benita
cf5b7a0958 Merge pull request #9103 from pytest-dev/update-plugin-list/patch-60e995d90
[automated] Update plugin list
2021-09-22 15:55:49 +03:00
Bruno Oliveira
f50652a5d2 Merge pull request #9111 from ziebam/iss4320-better-docs-for-testdir-copy-example 2021-09-22 07:51:42 -03:00
ziebam
70a3c965ea Add myself to AUTHORS file 2021-09-22 00:23:13 +02:00
ziebam
6ea762c46c Add a changelog entry 2021-09-22 00:22:37 +02:00
ziebam
520aa61e19 Improve docs for pytester.copy_example 2021-09-22 00:16:52 +02:00
Bruno Oliveira
fe44409cf6 Merge pull request #9107 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-09-20 21:28:03 -03:00
pre-commit-ci[bot]
43c0687a77 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.8b0 → 21.9b0](https://github.com/psf/black/compare/21.8b0...21.9b0)
2021-09-20 20:00:19 +00:00
pytest bot
86fc02bfcb [automated] Update plugin list 2021-09-19 00:10:14 +00:00
Bruno Oliveira
c761c45cf9 Remove obsolete projects page from docs
The projects page unfortunately contains a lot of old projects, and some information there appears to be stale.

It was created at a time pytest was starting to be used, but seems pointless now as pytest is the most popular testing framework, so listing a few dozen projects which use it seems pointless.

Rather than updating it, I think we should remove it because this has the chance to become stale again soon, and not sure how valuable it is anyway.
2021-09-14 08:04:49 -03:00
Bruno Oliveira
60e995d902 Merge pull request #9091 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-09-13 18:48:26 -03:00
pre-commit-ci[bot]
3867b681cd [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.25.0 → v2.26.0](https://github.com/asottile/pyupgrade/compare/v2.25.0...v2.26.0)
2021-09-13 19:40:27 +00:00
dependabot[bot]
87bbbaa0dc build(deps): bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.3.0...3.3.1)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-13 03:01:43 +00:00
Simon K
0e7bb34081 adding contact and badge for pytest-dev discord server (#9078)
* adding badges/docs for pytest-dev discord and pytest libera web chat
2021-09-12 18:22:44 +01:00
Bruno Oliveira
4e916ce347 Merge pull request #9086 from pytest-dev/update-plugin-list/patch-581b021aa
[automated] Update plugin list
2021-09-11 22:46:19 -03:00
pytest bot
0407c62121 [automated] Update plugin list 2021-09-12 00:11:27 +00:00
Bruno Oliveira
581b021aa2 Merge pull request #9084 from The-Compiler/remove-workshoptage
Remove finished open training
2021-09-10 08:26:21 -03:00
Florian Bruhin
1c1dcf27c8 Remove finished open training 2021-09-09 22:29:34 +02:00
Zac Hatfield-Dodds
8900e3b937 Merge pull request #9041 from hoefling/doc/stdlib-crossrefs 2021-09-07 21:22:24 +10:00
Bruno Oliveira
4274af1c28 Merge pull request #9076 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.2.7
build(deps): bump django from 3.2.5 to 3.2.7 in /testing/plugins_integration
2021-09-06 11:13:20 -03:00
Bruno Oliveira
9d0829f150 Merge pull request #9075 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-twisted-1.13.4
build(deps): bump pytest-twisted from 1.13.3 to 1.13.4 in /testing/plugins_integration
2021-09-06 11:13:00 -03:00
dependabot[bot]
ba14a81c7f build(deps): bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.2.5 to 3.2.7.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.5...3.2.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-06 03:01:53 +00:00
dependabot[bot]
af09415cd1 build(deps): bump pytest-twisted in /testing/plugins_integration
Bumps [pytest-twisted](https://github.com/pytest-dev/pytest-twisted) from 1.13.3 to 1.13.4.
- [Release notes](https://github.com/pytest-dev/pytest-twisted/releases)
- [Commits](https://github.com/pytest-dev/pytest-twisted/compare/v1.13.3...v1.13.4)

---
updated-dependencies:
- dependency-name: pytest-twisted
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-06 03:01:49 +00:00
Bruno Oliveira
01d046ecb3 Merge pull request #9073 from pytest-dev/update-plugin-list/patch-20863c3a0
[automated] Update plugin list
2021-09-05 12:32:19 -03:00
pytest bot
1f00461e57 [automated] Update plugin list 2021-09-05 00:09:51 +00:00
Andrew Neitsch
a9edfdf9db Run black on conf.py 2021-09-02 20:42:29 -06:00
Andrew Neitsch
b46d5f4657 Only use inkscapeconverter if inkscape installed 2021-09-02 20:40:17 -06:00
Andrew Neitsch
e929d15848 Include figures in PDF docs
The PDF documentation on readthedocs was missing the figures in the
fixtures reference chapter. This PR uses a Sphinx plugin that
automatically converts the checked-in SVG files to the PDF input files
that LaTeX requires.

The SVG-to-PDF conversion is done by inkscape, which gave the best
conversion among the tools I tried. However, it [does not yet
understand][href-bug] that you can write a plain `href` instead of
`xlink:href` in svg files, so I’ve had to edit the SVG files
accordingly.

[href-bug]: https://github.com/TeX-Live/luatex.git
2021-09-02 17:40:41 -06:00
Emmanuel Arias
dc9192c8eb add changelog file 2021-09-02 00:14:19 -03:00
Emmanuel Arias
59d314de3d Show fullname on direct Node construction warning
This commit add the fullname on the Node construction warning.
Also add a test for this case.
2021-09-01 16:13:26 -03:00
Bruno Oliveira
20863c3a0c Merge pull request #9065 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-08-30 16:49:04 -03:00
pre-commit-ci[bot]
7bcdcc0239 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.7b0 → 21.8b0](https://github.com/psf/black/compare/21.7b0...21.8b0)
- [github.com/asottile/blacken-docs: v1.10.0 → v1.11.0](https://github.com/asottile/blacken-docs/compare/v1.10.0...v1.11.0)
- [github.com/asottile/pyupgrade: v2.24.0 → v2.25.0](https://github.com/asottile/pyupgrade/compare/v2.24.0...v2.25.0)
2021-08-30 19:25:44 +00:00
Simon K
740abd9684 #9062 - Allow --stepwise-skip to implicitly enable --stepwise (#9064)
* #9062 - Allow `--stepwise-skip` to implicitly enable `--stepwise`

* Update changelog/9062.improvement.rst

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-08-30 19:24:14 +01:00
Kale Kundert
af42e7154a Prevent approx from being used without a comparison (#9061)
Some of the top search-engine hits for pytest.approx use the function without actually comparing it to anything.

This PR will cause these tests to fail by implementing approx.__bool__() to raise an AssertionError that briefly explains how to correctly use approx.
2021-08-30 18:19:31 +00:00
Bruno Oliveira
771c4b9313 Merge pull request #9063 from nicoddemus/cherry-pick-release
Merge pull request #9057 from pytest-dev/release-6.2.5
2021-08-30 15:13:58 -03:00
Bruno Oliveira
ea5ff44ef3 Merge pull request #9057 from pytest-dev/release-6.2.5
(cherry picked from commit 16664a1b72)
2021-08-30 14:44:49 -03:00
Bruno Oliveira
014fa61e0d Merge pull request #9053 from nicoddemus/change-8494-to-trivial 2021-08-29 10:52:01 -03:00
Bruno Oliveira
d023e6344a Merge pull request #9055 from pytest-dev/update-plugin-list/patch-398783521
[automated] Update plugin list
2021-08-29 00:35:42 -03:00
pytest bot
544ecce677 [automated] Update plugin list 2021-08-29 00:09:53 +00:00
Bruno Oliveira
14709f33af As discussed in Discord, move 3.10 changelog to trivial
This was backported to `6.2.x`, but we agreed this should
actually a trivial change and go into `6.2.5`, instead of a new `6.3.0`.
2021-08-28 11:59:53 -03:00
Bruno Oliveira
3987835213 Merge pull request #9049 from nicoddemus/prerelease-option
Fix prepare-release-pr invocation with empty --prerelease argument
2021-08-27 14:47:58 -03:00
Bruno Oliveira
675f8da3a1 Fix prepare-release-pr invocation with empty --prerelease argument 2021-08-27 14:46:28 -03:00
Bruno Oliveira
3c0510894b Merge pull request #9048 from nicoddemus/prerelease-option
'prerelease' input is not required in prepare-release-pr workflow
2021-08-27 14:40:11 -03:00
Bruno Oliveira
9501e54852 'prerelease' input is not required in prepare-release-pr workflow
The default is the correct value when generating a normal release.
2021-08-27 14:26:30 -03:00
Bruno Oliveira
b6aba1d58d Merge pull request #9047 from nicoddemus/changelog-9040
Add changelog for #9040 (pluggy 1.0)
2021-08-27 14:23:49 -03:00
Bruno Oliveira
44ba2fa372 Add changelog for #9040 (pluggy 1.0) 2021-08-27 14:09:21 -03:00
oleg.hoefling
d1aea7d7a8 use intersphinx crossrefs to stdlib docs where possible instead of hardcoded URLs
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-08-26 16:05:03 +02:00
Bruno Oliveira
41dc9bbc44 Merge pull request #9040 from nicoddemus/bump-pluggy 2021-08-26 10:14:27 -03:00
Bruno Oliveira
109bc2649d Adapt docs references to use pluggy 1.0
Also use the intersphinx reference instead of the class directly.
2021-08-26 09:52:05 -03:00
Bruno Oliveira
fbba504cd5 Allow pluggy >=1.0
Now that pluggy 1.0 has been released, we can allow pluggy 1.0 with new pytest versions.
2021-08-26 09:26:51 -03:00
Bruno Oliveira
1a2306cec6 Merge pull request #9033 from kulikjak/fix-cwd-removal-Solaris
Fix cwd removal on Solaris
2021-08-24 10:39:37 -03:00
Bruno Oliveira
78d21dc836 Merge pull request #9034 from williamjamir/williamjamir-patch-1
Fix typo in fixture.rst
2021-08-24 10:38:50 -03:00
William Jamir Silva
696bf96c83 Fix typo in fixture.rst 2021-08-24 09:32:40 -03:00
Bruno Oliveira
59189ebeb5 Merge pull request #9029 from pytest-dev/update-plugin-list/patch-83b609d7f
[automated] Update plugin list
2021-08-24 08:04:29 -03:00
Jakub Kulík
e146aaa2e2 Fix cwd removal on Solaris 2021-08-24 12:11:06 +02:00
Anthony Sottile
ebe5e451d1 Merge pull request #9031 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-08-23 15:27:47 -04:00
pre-commit-ci[bot]
e8aa395346 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.23.3 → v2.24.0](https://github.com/asottile/pyupgrade/compare/v2.23.3...v2.24.0)
2021-08-23 18:58:43 +00:00
pytest bot
1b130d4404 [automated] Update plugin list 2021-08-22 00:09:13 +00:00
Bruno Oliveira
83b609d7f7 Merge pull request #9028 from Exifers/patch-1
Fix typo in documentation
2021-08-21 11:49:11 -03:00
Emmanuel Meric de Bellefon
ec2099e057 Update index.rst 2021-08-21 11:11:37 +02:00
David Szotten
d5c020d8c5 always show full diff in ci
follow-up to #1314, for similar reasons

closes #9023
2021-08-19 20:17:43 +01:00
Florian Bruhin
c9870480e0 doc: Update trainings (#9022) 2021-08-19 18:40:19 +02:00
David Szotten
2367e6e9bf refactor ci helper to prepare for re-use 2021-08-19 11:24:51 +00:00
Bruno Oliveira
16077f2a65 Merge pull request #9017 from hugovk/update-deprecated-unittest-aliases 2021-08-18 08:11:50 -03:00
Hugo van Kemenade
5ec89fd6e5 Docs: refer to non-deprecated unittest alias 2021-08-18 12:43:59 +03:00
Anthony Sottile
720b91df2e Merge pull request #8995 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-08-17 14:36:42 -04:00
Bruno Oliveira
0f79fc6dbb Merge pull request #8752 from azmeuk/issue-7132-syntax-highlight-themes 2021-08-15 09:06:41 -03:00
Bruno Oliveira
36ed2f7d90 Merge pull request #9006 from pytest-dev/update-plugin-list/patch-243972941
[automated] Update plugin list
2021-08-15 09:04:32 -03:00
pytest bot
1cbb67f71b [automated] Update plugin list 2021-08-15 00:09:52 +00:00
Éloi Rivard
7770dacb8d pygments themes are customizable 2021-08-13 19:15:01 +02:00
pre-commit-ci[bot]
108f1d7e5e [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.23.1 → v2.23.3](https://github.com/asottile/pyupgrade/compare/v2.23.1...v2.23.3)
2021-08-09 18:53:50 +00:00
Terje Runde
2439729413 logging: Make it possible to add cli colors to custom log levels
Closes #8803
PR #8804

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Terje Runde <terje.runde@flir.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-08-09 13:48:47 +00:00
Ran Benita
df033f3ab1 Merge pull request #8987 from bluetech/k-backslash
mark/expression: allow backslash characters in identifiers
2021-08-08 17:15:53 +03:00
Ran Benita
25c65616f4 mark/expression: allow backslash characters in identifiers
Fixes #8983.
2021-08-08 11:56:17 +03:00
Bruno Oliveira
a446ee81fd Merge pull request #8985 from pytest-dev/update-plugin-list/patch-bacc8498e
[automated] Update plugin list
2021-08-08 01:43:27 -03:00
pytest bot
4d2944e1d4 [automated] Update plugin list 2021-08-08 00:10:10 +00:00
Simon K
bacc8498e9 pytest_assertion_pass is no longer considered experimental (#8967)
* `pytest_assertion_pass` is no longer considered `experimental`

* adding changelog
2021-08-03 14:31:18 +01:00
Bruno Oliveira
599e3dfdb6 Merge pull request #8970 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-08-02 21:06:34 -03:00
pre-commit-ci[bot]
b33c81b57f [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.23.0 → v2.23.1](https://github.com/asottile/pyupgrade/compare/v2.23.0...v2.23.1)
2021-08-02 18:53:11 +00:00
Bruno Oliveira
bacb8a4a56 Merge pull request #8968 from pytest-dev/dependabot/pip/testing/plugins_integration/twisted-21.7.0 2021-08-02 10:19:40 -03:00
dependabot[bot]
c22bf3ff3e build(deps): bump twisted in /testing/plugins_integration
Bumps [twisted](https://github.com/twisted/twisted) from 21.2.0 to 21.7.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-21.2.0...twisted-21.7.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-02 03:01:59 +00:00
Bruno Oliveira
e7916c4f4e [automated] Update plugin list (#8965)
Co-authored-by: pytest bot <pytestbot@users.noreply.github.com>
2021-08-01 15:06:40 -03:00
Bruno Oliveira
a83b359cf0 Refactor internal scope handling by introducing Scope enum
PR #8913
2021-08-01 06:11:56 -03:00
pytest bot
fed18fb76d [automated] Update plugin list 2021-08-01 00:10:10 +00:00
Simon K
ef5d81ad5c add assert_outcomes(warnings=) functionality to RunResult
* expose `warnings=` to pytester `assert_outcomes()`

* fix test fallout from adding warnings= to assert_outcomes()

* #closes 8593 - Improve test and add a `changelog` entry for the change
2021-07-31 15:25:10 +01:00
Simon K
c27db3bd8e Deprecate pytest_cmdline_preparse
Close #8592 

PR #8956
2021-07-31 10:53:43 -03:00
Bruno Oliveira
0fd0e2a27c Merge pull request #8963 from symonk/mypy-pathlike-runtime-checkable-fix
typeshed `os.PathLike` is now `@runtime_checkable`, remove mypy ignore
2021-07-31 10:27:58 -03:00
Emmanuel Arias
2834b39b65 Add examples of parametrizing classes and all tests in a module
Closes #8947

PR #8962
2021-07-31 13:26:25 +00:00
symonk
1b9ba65b3f typeshed os.PathLike is now @runtime_checkable, remove mypy ignore 2021-07-31 14:00:36 +01:00
Ran Benita
6247a95601 Merge pull request #8920 from bluetech/stabilize-store
Rename Store to Stash and make it public
2021-07-31 10:32:30 +03:00
Bruno Oliveira
60d9891474 Fix small typo in pluggy writing hook functions docs (#8961)
Fix small typo in pluggy writing hook functions docs
2021-07-30 22:27:01 -03:00
symonk
a9a934e8ce fix minor typo in writing hook functions documentation 2021-07-31 01:49:53 +01:00
Simon K
d5c62d0326 Making --debug more configurable for the pytest user (#8955)
Close #8954
2021-07-30 17:37:38 -03:00
Simon K
6d6bc97231 #7124: Fix --doctest-modules crashing when __main__.py is present (#8949)
* Fix ``--doctest-modules`` crashing when ``__main__.py`` is present
2021-07-27 22:50:26 +01:00
Bruno Oliveira
6a1ba80ab7 Merge pull request #8946 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-07-27 07:57:03 -03:00
Bruno Oliveira
df6d3b7dde Fix Dead link in README for 'assert statements' (#8945)
Closes: #8926
2021-07-27 07:56:19 -03:00
pre-commit-ci[bot]
237bdba061 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v2.5.0 → v2.6.0](https://github.com/asottile/reorder_python_imports/compare/v2.5.0...v2.6.0)
- [github.com/asottile/pyupgrade: v2.21.2 → v2.23.0](https://github.com/asottile/pyupgrade/compare/v2.21.2...v2.23.0)
2021-07-26 18:05:01 +00:00
Emmanuel Arias
15989ddc8f Fix Dead link in README for 'assert statements'
Closes: #8926
2021-07-26 12:14:52 -03:00
Simon K
1d848314d0 some small quality of life changes (#8454)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-07-26 07:48:15 -03:00
Bruno Oliveira
90b70a7efe Merge pull request #8942 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-twisted-1.13.3
build(deps): bump pytest-twisted from 1.13.2 to 1.13.3 in /testing/plugins_integration
2021-07-26 06:58:02 -03:00
Bruno Oliveira
4cc2781ad8 Merge pull request #8943 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--3.3.0
build(deps): bump anyio[curio,trio] from 3.2.1 to 3.3.0 in /testing/plugins_integration
2021-07-26 06:57:51 -03:00
dependabot[bot]
b35a3de006 build(deps): bump anyio[curio,trio] in /testing/plugins_integration
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio) from 3.2.1 to 3.3.0.
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/anyio/compare/3.2.1...3.3.0)

---
updated-dependencies:
- dependency-name: anyio[curio,trio]
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-26 03:01:29 +00:00
dependabot[bot]
de8ad53963 build(deps): bump pytest-twisted in /testing/plugins_integration
Bumps [pytest-twisted](https://github.com/pytest-dev/pytest-twisted) from 1.13.2 to 1.13.3.
- [Release notes](https://github.com/pytest-dev/pytest-twisted/releases)
- [Commits](https://github.com/pytest-dev/pytest-twisted/compare/v1.13.2...v1.13.3)

---
updated-dependencies:
- dependency-name: pytest-twisted
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-26 03:01:26 +00:00
Ran Benita
9c9d79890d Merge pull request #8941 from pytest-dev/update-plugin-list/patch-305e15df9
[automated] Update plugin list
2021-07-25 12:28:03 +03:00
pytest bot
8b5b3575a0 [automated] Update plugin list 2021-07-25 00:08:36 +00:00
Ran Benita
2aaea20cb2 Use {node,config}.stash instead of ._store
Use the public name. The `_store` name is only because some plugins
started using it anyway - will be removed at some point.
2021-07-24 17:40:08 +03:00
Ran Benita
c6bdeb8491 stash: make Stash and StashKey public
It's had enough time to bake - let's allow external plugins to use it.
2021-07-24 17:40:08 +03:00
Ran Benita
305e15df97 Merge pull request #8937 from nicoddemus/port-8932
contact.rst: Added github discussions
2021-07-24 11:32:07 +03:00
Bruno Oliveira
5e39f43e7c contact.rst: Added github discussions
Ported from #8932
2021-07-23 09:40:11 -03:00
Ronny Pfannschmidt
bd09b79236 Merge pull request #8922 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-07-20 10:42:38 +02:00
pre-commit-ci[bot]
53357f464c [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/psf/black: 21.6b0 → 21.7b0](https://github.com/psf/black/compare/21.6b0...21.7b0)
- [github.com/asottile/pyupgrade: v2.21.0 → v2.21.2](https://github.com/asottile/pyupgrade/compare/v2.21.0...v2.21.2)
2021-07-19 22:13:39 +00:00
Ran Benita
7ff07ff3e1 Merge pull request #8919 from pytest-dev/update-plugin-list/patch-940c6e233
[automated] Update plugin list
2021-07-18 16:13:14 +03:00
Ran Benita
5f39e31736 stash: implement __len__
Part of the MutableMapping abc (though we can't actually implement
that).
2021-07-18 15:32:52 +03:00
Ran Benita
5470d33e82 store: rename Store to Stash
The name "stash" is a bit more distinguishable and more evocative of the
intended usage.
2021-07-18 15:21:27 +03:00
pytest bot
0a1f58a912 [automated] Update plugin list 2021-07-18 00:08:39 +00:00
Bruno Oliveira
940c6e2337 Merge pull request #8904 from nicoddemus/types-atomicwrites
Add types-atomicwrites to mypy's pre-commit configuration
2021-07-15 12:35:51 -03:00
Thomas Grainger
388691a205 rename tmpdir.rst to tmp_path.rst (#8905) 2021-07-14 12:53:27 -03:00
Naveen-Pratap
febb978651 Update error message for module level skip to include 'allow_module_level' (#8906)
Co-authored-by: Naveen <NaveenPr1@microland.com>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2021-07-14 14:27:26 +00:00
Bruno Oliveira
69356d20cf Merge pull request #8903 from nicoddemus/remove-fspath-deprecation
Revert fspath deprecation
2021-07-14 09:32:48 -03:00
Bruno Oliveira
828fde1156 Merge pull request #8858 from The-Compiler/update-doc-urls 2021-07-14 09:28:46 -03:00
Bruno Oliveira
d71d31c1e0 Merge pull request #8812 from pytest-dev/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2021-07-13 08:31:32 -03:00
Bruno Oliveira
794f467647 Merge pull request #8854 from pytest-dev/dependabot/pip/testing/plugins_integration/django-3.2.5 2021-07-13 08:30:28 -03:00
Bruno Oliveira
913d0c2380 Merge pull request #8855 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-rerunfailures-10.1
build(deps): bump pytest-rerunfailures from 10.0 to 10.1 in /testing/plugins_integration
2021-07-13 08:30:13 -03:00
Bruno Oliveira
59b86cf328 Merge pull request #8856 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-bdd-4.1.0
build(deps): bump pytest-bdd from 4.0.2 to 4.1.0 in /testing/plugins_integration
2021-07-13 08:29:47 -03:00
Bruno Oliveira
b88ee5bc55 Add types-atomicwrites to mypy's pre-commit configuration
This is a Windows only dependency, so the problem only shows up when trying to commit on Windows.
2021-07-13 08:27:35 -03:00
Bruno Oliveira
2c4c57e135 Revert fspath deprecation
It is not clear yet how we should proceed with this deprecation
because `pytest.Item.reportinfo` is public API and returns a `py.path` object,
and is not clear how plugins and our examples should handle that.

Reverting just the deprecation aspect of #8251 so we can get a 7.0.0 release out.

We will reintroduce the deprecation later once we have a clear path moving forward with replacing `reportinfo`.

Closes #8445
Closes #8821
2021-07-13 08:24:39 -03:00
Ronny Pfannschmidt
d0bd269b87 Merge pull request #8899 from gsmecher/parameterize-complex-numbers
Generate useful parameterization IDs for complex() numbers.
2021-07-13 07:03:37 +02:00
pre-commit-ci[bot]
7d1efd5c3a [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.19.4 → v2.21.0](https://github.com/asottile/pyupgrade/compare/v2.19.4...v2.21.0)
- [github.com/pre-commit/mirrors-mypy: v0.902 → v0.910](https://github.com/pre-commit/mirrors-mypy/compare/v0.902...v0.910)
2021-07-12 23:27:47 +00:00
Bruno Oliveira
3c18a9ecd0 Rename 8898.trivial.rst to 8898.improvement.rst 2021-07-12 18:09:13 -03:00
Graeme Smecher
5c04674e96 Generate useful parameterization IDs for complex() numbers. 2021-07-12 12:27:24 -07:00
Miro Hrončok
5165bf97c6 Revert "Adjust enum reprs for Python 3.10" (#8896)
This reverts commit 710446420c.

The change was reverted in Python 3.10.0b4:

https://mail.python.org/archives/list/python-dev@python.org/message/LSTMFAPSPD3BGZ4D6HQFODXZVB3PLYKF/
2021-07-12 14:32:27 +00:00
Bruno Oliveira
4a6acea1e3 Merge pull request #8888 from pytest-dev/update-plugin-list/patch-5d8392cb6
[automated] Update plugin list
2021-07-12 10:16:40 -03:00
pytest bot
b6648219ec [automated] Update plugin list 2021-07-11 00:08:26 +00:00
Anthony Sottile
5d8392cb68 Merge pull request #8874 from adamjstewart/monkeypatch/setenv
Docs: monkeypatch.setenv does not accept bool
2021-07-09 11:38:25 -04:00
Anthony Sottile
0182eb3743 Merge pull request #8881 from pytest-dev/asottile-patch-1
Remove upper pinning on tomli
2021-07-09 10:27:58 -04:00
Anthony Sottile
fa42be77a6 Remove upper pinning on tomli
the best practice is to only `<` when you know something is broken, and even then prefer `!=` assuming it will be fixed upstream for maximum compatibility
2021-07-09 10:09:05 -04:00
Bruno Oliveira
e86bf7fda0 Merge pull request #8857 from hukkin/tomli
Support TOML v1.0.0 syntax in `pyproject.toml`
2021-07-09 11:05:46 -03:00
Adam J. Stewart
17f1a0af8e Fix in more places, use default 2021-07-08 12:43:10 -05:00
Adam J. Stewart
3989a9bb05 Docs: monkeypatch.setenv does not accept bool 2021-07-08 12:21:30 -05:00
Sören Wegener
6740fb9da6 doc: Typofix in fixtures how-to (#8860) 2021-07-06 14:31:21 +00:00
Taneli Hukkinen
5987251407 Add a test for invalid TOML file 2021-07-06 16:53:32 +03:00
Taneli Hukkinen
40797dee87 Make news indicate that a dependency changed 2021-07-06 13:14:45 +03:00
Taneli Hukkinen
e1a4b4edd2 Convert TOMLDecodeError to UsageError 2021-07-06 13:10:44 +03:00
pre-commit-ci[bot]
51f645e567 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2021-07-06 07:18:57 +00:00
Florian Bruhin
953fdabaf0 Adjust doc links for new scheme
Closes #8831
2021-07-06 09:11:35 +02:00
Taneli Hukkinen
e942b12b94 Support TOML v1.0.0 syntax in pyproject.toml 2021-07-06 00:26:01 +03:00
dependabot[bot]
904637baa7 build(deps): bump pytest-bdd in /testing/plugins_integration
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd) from 4.0.2 to 4.1.0.
- [Release notes](https://github.com/pytest-dev/pytest-bdd/releases)
- [Changelog](https://github.com/pytest-dev/pytest-bdd/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-bdd/compare/4.0.2...4.1.0)

---
updated-dependencies:
- dependency-name: pytest-bdd
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-05 03:01:53 +00:00
dependabot[bot]
3e108012d9 build(deps): bump pytest-rerunfailures in /testing/plugins_integration
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 10.0 to 10.1.
- [Release notes](https://github.com/pytest-dev/pytest-rerunfailures/releases)
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst)
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/10.0...10.1)

---
updated-dependencies:
- dependency-name: pytest-rerunfailures
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-05 03:01:51 +00:00
dependabot[bot]
2d5990c443 build(deps): bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.4...3.2.5)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-05 03:01:49 +00:00
Florian Bruhin
8347b59295 Update remaining 7.0 references (#8834) 2021-07-04 10:27:43 +02:00
Eric Liu
8c25a14032 closes #8824 Changelog rewording for 7.0 (#8826)
* fixed changelog/*.rst docs

* add author name

* fixed-documents

* fix issue 8761 doc

* fix issue 8645 doc

* fix issue 8447 doc

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-07-03 12:20:12 +02:00
ericluoliu
501637547e Issue #8823 - remove bots from contributors list (#8828)
* fix-contributors-list

* remove-bots

* delete-extraneous-file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-06-30 13:53:32 +00:00
Srip
9cdb7223b5 doc: Adding the missing sys import (#8819) (#8827)
Co-authored-by: Sripradha Karkala <sripradha.karkala@nutanix.com>
2021-06-30 08:11:20 +02:00
Bruno Oliveira
1d67553403 Merge pull request #8247 from nicoddemus/version-stdout-8246 2021-06-28 16:13:31 -03:00
Florian Bruhin
4d965557e2 ci: Persist git credentials for prepare-release-pr (#8813)
See #8599, follow-up to #8681
2021-06-28 20:58:55 +02:00
Thomas Grainger
5227279c15 Update changelog/3664.deprecation.rst 2021-03-19 09:47:19 +00:00
Thomas Grainger
a7e0ae2455 update MARKED_FIXTURE deprecation message 2021-03-19 09:44:39 +00:00
Thomas Grainger
12efc58479 document deprecation in deprecations.rst 2021-03-19 09:43:22 +00:00
Thomas Grainger
3f71680ac0 Warn when a mark is applied to a fixture
Fixes #3664
2021-03-19 09:30:52 +00:00
482 changed files with 47933 additions and 16989 deletions

View File

@@ -25,6 +25,9 @@ exclude_lines =
^\s*raise NotImplementedError\b
^\s*return NotImplemented\b
^\s*assert False(,|$)
^\s*assert_never\(
^\s*if TYPE_CHECKING:
^\s*@overload( |$)
^\s*@pytest\.mark\.xfail

View File

@@ -23,6 +23,13 @@ afc607cfd81458d4e4f3b1f3cf8cc931b933907e
5f95dce95602921a70bfbc7d8de2f7712c5e4505
# ran pyupgrade-docs again
75d0b899bbb56d6849e9d69d83a9426ed3f43f8b
# move argument parser to own file
c9df77cbd6a365dcb73c39618e4842711817e871
# Replace reorder-python-imports by isort due to black incompatibility (#11896)
8b54596639f41dfac070030ef20394b9001fe63c
# Run blacken-docs with black's 2024's style
4546d5445aaefe6a03957db028c263521dfb5c4b
# Migration to ruff / ruff format
4588653b2497ed25976b7aaff225b889fb476756
# Use format specifiers instead of percent format
4788165e69d08e10fc6b9c0124083fb358e2e9b0

20
.github/chronographer.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
---
branch-protection-check-name: Changelog entry
action-hints:
check-title-prefix: "Chronographer: "
external-docs-url: >-
https://docs.pytest.org/en/latest/contributing.html#preparing-pull-requests
inline-markdown: >-
See
https://docs.pytest.org/en/latest/contributing.html#preparing-pull-requests
for details.
enforce-name:
suffix: .rst
exclude:
humans:
- pyup-bot
labels:
skip-changelog: skip news
...

View File

@@ -9,3 +9,9 @@ updates:
allow:
- dependency-type: direct
- dependency-type: indirect
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
time: "03:00"
open-pull-requests-limit: 10

7
.github/patchback.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
---
backport_branch_prefix: patchback/backports/
backport_label_prefix: 'backport ' # IMPORTANT: the labels are space-delimited
# target_branch_prefix: '' # The project's backport branches are non-prefixed
...

108
.github/workflows/deploy.yml vendored Normal file
View File

@@ -0,0 +1,108 @@
name: deploy
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
default: '1.2.3'
# Set permissions at the job level.
permissions: {}
jobs:
package:
runs-on: ubuntu-latest
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
timeout-minutes: 10
# Required by attest-build-provenance-github.
permissions:
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v2.6.0
with:
attest-build-provenance-github: 'true'
deploy:
if: github.repository == 'pytest-dev/pytest'
needs: [package]
runs-on: ubuntu-latest
environment: deploy
timeout-minutes: 30
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Download Package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.9.0
- name: Push tag
run: |
git config user.name "pytest bot"
git config user.email "pytestbot@gmail.com"
git tag --annotate --message=v${{ github.event.inputs.version }} ${{ github.event.inputs.version }} ${{ github.sha }}
git push origin ${{ github.event.inputs.version }}
release-notes:
# todo: generate the content in the build job
# the goal being of using a github action script to push the release data
# after success instead of creating a complete python/tox env
needs: [deploy]
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Download Package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install --upgrade tox
- name: Generate release notes
run: |
sudo apt-get install pandoc
tox -e generate-gh-release-notes -- ${{ github.event.inputs.version }} scripts/latest-release-notes.md
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: scripts/latest-release-notes.md
files: dist/*
tag_name: ${{ github.event.inputs.version }}

View File

@@ -1,242 +0,0 @@
name: main
on:
push:
branches:
- main
- "[0-9]+.[0-9]+.x"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
pull_request:
branches:
- main
- "[0-9]+.[0-9]+.x"
env:
PYTEST_ADDOPTS: "--color=yes"
# Set permissions at the job level.
permissions: {}
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read
strategy:
fail-fast: false
matrix:
name: [
"windows-py36",
"windows-py37",
"windows-py37-pluggy",
"windows-py38",
"windows-py39",
"windows-py310",
"ubuntu-py36",
"ubuntu-py37",
"ubuntu-py37-pluggy",
"ubuntu-py37-freeze",
"ubuntu-py38",
"ubuntu-py39",
"ubuntu-py310",
"ubuntu-pypy3",
"macos-py37",
"macos-py38",
"docs",
"doctesting",
"plugins",
]
include:
- name: "windows-py36"
python: "3.6"
os: windows-latest
tox_env: "py36-xdist"
- name: "windows-py37"
python: "3.7"
os: windows-latest
tox_env: "py37-numpy"
- name: "windows-py37-pluggy"
python: "3.7"
os: windows-latest
tox_env: "py37-pluggymain-xdist"
- name: "windows-py38"
python: "3.8"
os: windows-latest
tox_env: "py38-unittestextras"
use_coverage: true
- name: "windows-py39"
python: "3.9"
os: windows-latest
tox_env: "py39-xdist"
- name: "windows-py310"
python: "3.10-dev"
os: windows-latest
tox_env: "py310-xdist"
- name: "ubuntu-py36"
python: "3.6"
os: ubuntu-latest
tox_env: "py36-xdist"
- name: "ubuntu-py37"
python: "3.7"
os: ubuntu-latest
tox_env: "py37-lsof-numpy-pexpect"
use_coverage: true
- name: "ubuntu-py37-pluggy"
python: "3.7"
os: ubuntu-latest
tox_env: "py37-pluggymain-xdist"
- name: "ubuntu-py37-freeze"
python: "3.7"
os: ubuntu-latest
tox_env: "py37-freeze"
- name: "ubuntu-py38"
python: "3.8"
os: ubuntu-latest
tox_env: "py38-xdist"
- name: "ubuntu-py39"
python: "3.9"
os: ubuntu-latest
tox_env: "py39-xdist"
- name: "ubuntu-py310"
python: "3.10-dev"
os: ubuntu-latest
tox_env: "py310-xdist"
- name: "ubuntu-pypy3"
python: "pypy-3.7"
os: ubuntu-latest
tox_env: "pypy3-xdist"
- name: "macos-py37"
python: "3.7"
os: macos-latest
tox_env: "py37-xdist"
- name: "macos-py38"
python: "3.8"
os: macos-latest
tox_env: "py38-xdist"
use_coverage: true
- name: "plugins"
python: "3.7"
os: ubuntu-latest
tox_env: "plugins"
- name: "docs"
python: "3.7"
os: ubuntu-latest
tox_env: "docs"
- name: "doctesting"
python: "3.7"
os: ubuntu-latest
tox_env: "doctesting"
use_coverage: true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox coverage
- name: Test without coverage
if: "! matrix.use_coverage"
run: "tox -e ${{ matrix.tox_env }}"
- name: Test with coverage
if: "matrix.use_coverage"
run: "tox -e ${{ matrix.tox_env }}-coverage"
- name: Upload coverage
if: matrix.use_coverage && github.repository == 'pytest-dev/pytest'
env:
CODECOV_NAME: ${{ matrix.name }}
run: bash scripts/upload-coverage.sh -F GHA,${{ runner.os }}
linting:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- uses: actions/setup-python@v2
- name: set PY
run: echo "name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- run: tox -e linting
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest'
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
needs: [build]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade wheel setuptools tox
- 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 }}
- name: Publish GitHub release notes
env:
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
run: |
sudo apt-get install pandoc
tox -e publish-gh-release-notes

View File

@@ -13,7 +13,7 @@ on:
default: 'no'
prerelease:
description: 'Prerelease (ex: rc1). Leave empty if not a pre-release.'
required: true
required: false
default: ''
# Set permissions at the job level.
@@ -27,13 +27,12 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.8"
@@ -45,9 +44,9 @@ jobs:
- name: Prepare release PR (minor/patch release)
if: github.event.inputs.major == 'no'
run: |
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --prerelease '${{ github.event.inputs.prerelease }}'
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --prerelease='${{ github.event.inputs.prerelease }}'
- name: Prepare release PR (major release)
if: github.event.inputs.major == 'yes'
run: |
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major --prerelease '${{ github.event.inputs.prerelease }}'
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major --prerelease='${{ github.event.inputs.prerelease }}'

23
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: close needs-information issues
on:
schedule:
- cron: "30 1 * * *"
workflow_dispatch:
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/stale@v9
with:
debug-only: false
days-before-issue-stale: 14
days-before-issue-close: 7
only-labels: "status: needs information"
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has the `status: needs information` label and requested follow-up information was not provided for 14 days."
close-issue-message: "This issue was closed because it has the `status: needs information` label and follow-up information has not been provided for 7 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1

267
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,267 @@
name: test
on:
push:
branches:
- main
- "[0-9]+.[0-9]+.x"
- "test-me-*"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
pull_request:
branches:
- main
- "[0-9]+.[0-9]+.x"
types:
- opened # default
- synchronize # default
- reopened # default
- ready_for_review # used in PRs created from the release workflow
env:
PYTEST_ADDOPTS: "--color=yes"
# Cancel running jobs for the same workflow and branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Set permissions at the job level.
permissions: {}
jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v2.6.0
build:
needs: [package]
runs-on: ${{ matrix.os }}
timeout-minutes: 45
permissions:
contents: read
strategy:
fail-fast: false
matrix:
name: [
"windows-py38",
"windows-py38-pluggy",
"windows-py39",
"windows-py310",
"windows-py311",
"windows-py312",
"windows-py313",
"ubuntu-py38",
"ubuntu-py38-pluggy",
"ubuntu-py38-freeze",
"ubuntu-py39",
"ubuntu-py310",
"ubuntu-py311",
"ubuntu-py312",
"ubuntu-py313",
"ubuntu-pypy3",
"macos-py38",
"macos-py39",
"macos-py310",
"macos-py312",
"macos-py313",
"doctesting",
"plugins",
]
include:
- name: "windows-py38"
python: "3.8"
os: windows-latest
tox_env: "py38-unittestextras"
use_coverage: true
- name: "windows-py38-pluggy"
python: "3.8"
os: windows-latest
tox_env: "py38-pluggymain-pylib-xdist"
- name: "windows-py39"
python: "3.9"
os: windows-latest
tox_env: "py39-xdist"
- name: "windows-py310"
python: "3.10"
os: windows-latest
tox_env: "py310-xdist"
- name: "windows-py311"
python: "3.11"
os: windows-latest
tox_env: "py311"
- name: "windows-py312"
python: "3.12"
os: windows-latest
tox_env: "py312"
- name: "windows-py313"
python: "3.13-dev"
os: windows-latest
tox_env: "py313"
- name: "ubuntu-py38"
python: "3.8"
os: ubuntu-latest
tox_env: "py38-lsof-numpy-pexpect"
use_coverage: true
- name: "ubuntu-py38-pluggy"
python: "3.8"
os: ubuntu-latest
tox_env: "py38-pluggymain-pylib-xdist"
- name: "ubuntu-py38-freeze"
python: "3.8"
os: ubuntu-latest
tox_env: "py38-freeze"
- name: "ubuntu-py39"
python: "3.9"
os: ubuntu-latest
tox_env: "py39-xdist"
- name: "ubuntu-py310"
python: "3.10"
os: ubuntu-latest
tox_env: "py310-xdist"
- name: "ubuntu-py311"
python: "3.11"
os: ubuntu-latest
tox_env: "py311"
use_coverage: true
- name: "ubuntu-py312"
python: "3.12"
os: ubuntu-latest
tox_env: "py312"
use_coverage: true
- name: "ubuntu-py313"
python: "3.13-dev"
os: ubuntu-latest
tox_env: "py313"
use_coverage: true
- name: "ubuntu-pypy3"
python: "pypy-3.8"
os: ubuntu-latest
tox_env: "pypy3-xdist"
- name: "macos-py38"
python: "3.8"
os: macos-latest
tox_env: "py38-xdist"
- name: "macos-py39"
python: "3.9"
os: macos-latest
tox_env: "py39-xdist"
use_coverage: true
- name: "macos-py310"
python: "3.10"
os: macos-latest
tox_env: "py310-xdist"
- name: "macos-py312"
python: "3.12"
os: macos-latest
tox_env: "py312-xdist"
- name: "macos-py313"
python: "3.13-dev"
os: macos-latest
tox_env: "py313-xdist"
- name: "plugins"
python: "3.12"
os: ubuntu-latest
tox_env: "plugins"
- name: "doctesting"
python: "3.8"
os: ubuntu-latest
tox_env: "doctesting"
use_coverage: true
continue-on-error: >-
${{
contains(
fromJSON(
'[
"windows-py38-pluggy",
"windows-py313",
"ubuntu-py38-pluggy",
"ubuntu-py38-freeze",
"ubuntu-py313",
"macos-py38",
"macos-py313"
]'
),
matrix.name
)
&& true
|| false
}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Download Package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
check-latest: ${{ endsWith(matrix.python, '-dev') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox coverage
- name: Test without coverage
if: "! matrix.use_coverage"
shell: bash
run: tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz`
- name: Test with coverage
if: "matrix.use_coverage"
shell: bash
run: tox run -e ${{ matrix.tox_env }}-coverage --installpkg `find dist/*.tar.gz`
- name: Generate coverage report
if: "matrix.use_coverage"
run: python -m coverage xml
- name: Upload coverage to Codecov
if: "matrix.use_coverage"
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
files: ./coverage.xml
verbose: true
check: # This job does nothing and is only used for the branch protection
if: always()
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@223e4bb7a751b91f43eda76992bcfbf23b8b0302
with:
jobs: ${{ toJSON(needs) }}

View File

@@ -11,7 +11,8 @@ on:
permissions: {}
jobs:
createPullRequest:
update-plugin-list:
if: github.repository_owner == 'pytest-dev'
runs-on: ubuntu-latest
permissions:
contents: write
@@ -19,25 +20,34 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.11"
cache: pip
- name: requests-cache
uses: actions/cache@v4
with:
path: ~/.cache/pytest-plugin-list/
key: plugins-http-cache-${{ github.run_id }} # Can use time based key as well
restore-keys: plugins-http-cache-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install packaging requests tabulate[widechars]
pip install packaging requests tabulate[widechars] tqdm requests-cache platformdirs
- name: Update Plugin List
run: python scripts/update-plugin-list.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@2455e1596942c2902952003bbb574afbbe2ab2e6
id: pr
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c
with:
commit-message: '[automated] Update plugin list'
author: 'pytest bot <pytestbot@users.noreply.github.com>'
@@ -46,3 +56,13 @@ jobs:
branch-suffix: short-commit-hash
title: '[automated] Update plugin list'
body: '[automated] Update plugin list'
draft: true
- name: Instruct the maintainers to trigger CI by undrafting the PR
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh pr comment
--body 'Please mark the PR as ready for review to trigger PR checks.'
--repo '${{ github.repository }}'
'${{ steps.pr.outputs.pull-request-number }}'

6
.gitignore vendored
View File

@@ -25,7 +25,6 @@ src/_pytest/_version.py
doc/*/_build
doc/*/.doctrees
doc/*/_changelog_towncrier_draft.rst
build/
dist/
*.egg-info
@@ -50,6 +49,11 @@ coverage.xml
.project
.settings
.vscode
__pycache__/
.python-version
# generated by pip
pip-wheel-metadata/
# pytest debug logs generated via --debug
pytestdebug.log

View File

@@ -1,67 +1,62 @@
repos:
- repo: https://github.com/psf/black
rev: 21.6b0
hooks:
- id: black
args: [--safe, --quiet]
- repo: https://github.com/asottile/blacken-docs
rev: v1.10.0
hooks:
- id: blacken-docs
additional_dependencies: [black==20.8b1]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.10"
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: fix-encoding-pragma
args: [--remove]
- id: check-yaml
- id: debug-statements
exclude: _pytest/(debugging|hookspec).py
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- flake8-typing-imports==1.9.0
- flake8-docstrings==1.5.0
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.5.0
hooks:
- id: reorder-python-imports
args: ['--application-directories=.:src', --py36-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v2.19.4
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
hooks:
- id: setup-cfg-fmt
args: [--max-py-version=3.10]
- id: blacken-docs
additional_dependencies: [black==24.1.1]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: python-use-type-annotations
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.902
rev: v1.10.0
hooks:
- id: mypy
files: ^(src/|testing/)
files: ^(src/|testing/|scripts/)
args: []
additional_dependencies:
- iniconfig>=1.1.0
- py>=1.8.2
- attrs>=19.2.0
- pluggy>=1.5.0
- packaging
- types-toml
- tomli
- types-pkg_resources
- types-tabulate
# for mypy running on python>=3.11 since exceptiongroup is only a dependency
# on <3.11
- exceptiongroup>=1.0.0rc8
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.1.3"
hooks:
- id: pyproject-fmt
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
additional_dependencies: ["tox>=4.9"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
hooks:
- id: pyupgrade
stages: [manual]
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: ["-rn", "-sn", "--fail-on=I"]
stages: [manual]
- id: rst
name: rst
entry: rst-lint --encoding utf-8
@@ -71,9 +66,50 @@ repos:
- id: changelogs-rst
name: changelog filenames
language: fail
entry: 'changelog files must be named ####.(breaking|bugfix|deprecation|doc|feature|improvement|trivial|vendor).rst'
exclude: changelog/(\d+\.(breaking|bugfix|deprecation|doc|feature|improvement|trivial|vendor).rst|README.rst|_template.rst)
entry: >-
changelog files must be named
####.(
breaking
| deprecation
| feature
| improvement
| bugfix
| vendor
| doc
| packaging
| contrib
| misc
)(.#)?(.rst)?
exclude: >-
(?x)
^
changelog/(
\.gitignore
|\d+\.(
breaking
|deprecation
|feature
|improvement
|bugfix
|vendor
|doc
|packaging
|contrib
|misc
)(\.\d+)?(\.rst)?
|README\.rst
|_template\.rst
)
$
files: ^changelog/
- id: changelogs-user-role
name: Changelog files should use a non-broken :user:`name` role
language: pygrep
entry: :user:([^`]+`?|`[^`]+[\s,])
pass_filenames: true
types:
- file
- rst
- id: py-deprecated
name: py library is deprecated
language: pygrep
@@ -92,7 +128,7 @@ repos:
types: [python]
- id: py-path-deprecated
name: py.path usage is deprecated
exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py
exclude: docs|src/_pytest/deprecated.py|testing/deprecated_test.py|src/_pytest/legacypath.py
language: pygrep
entry: \bpy\.path\.local
types: [python]

31
.readthedocs.yaml Normal file
View File

@@ -0,0 +1,31 @@
version: 2
python:
install:
# Install pytest first, then doc/en/requirements.txt.
# This order is important to honor any pins in doc/en/requirements.txt
# when the pinned library is also a dependency of pytest.
- method: pip
path: .
- requirements: doc/en/requirements.txt
sphinx:
configuration: doc/en/conf.py
fail_on_warning: true
build:
os: ubuntu-24.04
tools:
python: >-
3.12
apt_packages:
- inkscape
jobs:
post_checkout:
- git fetch --unshallow || true
- git fetch --tags || true
formats:
- epub
- pdf
- htmlzip

View File

@@ -1,12 +0,0 @@
version: 2
python:
version: 3.7
install:
- requirements: doc/en/requirements.txt
- method: pip
path: .
formats:
- epub
- pdf

129
AUTHORS
View File

@@ -8,12 +8,19 @@ Abdeali JK
Abdelrahman Elbehery
Abhijeet Kasurde
Adam Johnson
Adam Stewart
Adam Uhlir
Ahn Ki-Wook
Akhilesh Ramakrishnan
Akiomi Kamakura
Alan Velasco
Alessio Izzo
Alex Jones
Alex Lambson
Alexander Johnson
Alexander King
Alexei Kozlenok
Alice Purcell
Allan Feldman
Aly Sivji
Amir Elkess
@@ -29,6 +36,7 @@ Andrey Paramonov
Andrzej Klajnert
Andrzej Ostrowski
Andy Freeland
Anita Hammer
Anthon van der Neut
Anthony Shaw
Anthony Sottile
@@ -36,23 +44,33 @@ Anton Grinevich
Anton Lodder
Antony Lee
Arel Cordero
Arias Emmanuel
Ariel Pillemer
Armin Rigo
Aron Coyle
Aron Curzon
Arthur Richard
Ashish Kurmi
Aviral Verma
Aviv Palivoda
Babak Keyvani
Barney Gale
Ben Brown
Ben Gartner
Ben Leith
Ben Webb
Benjamin Peterson
Benjamin Schubert
Bernard Pratz
Bo Wu
Bob Ippolito
Brian Dorsey
Brian Larsen
Brian Maissy
Brian Okken
Brianna Laugher
Bruno Oliveira
Cal Jacobson
Cal Leeming
Carl Friedrich Bolz
Carlos Jenkins
@@ -60,9 +78,12 @@ Ceridwen
Charles Cloud
Charles Machalow
Charnjit SiNGH (CCSJ)
Cheuk Ting Ho
Chris Mahoney
Chris Lamb
Chris NeJame
Chris Rose
Chris Wheeler
Christian Boelsen
Christian Fetzer
Christian Neumüller
@@ -74,12 +95,17 @@ Christopher Dignam
Christopher Gilling
Claire Cecil
Claudio Madotto
Clément M.T. Robert
CrazyMerlyn
Cristian Vera
Cyrus Maden
Damian Skrzypczak
Daniel Grana
Daniel Hahler
Daniel Miller
Daniel Nuri
Daniel Sánchez Castelló
Daniel Valenzuela Zenteno
Daniel Wandschneider
Daniele Procida
Danielle Jenkins
@@ -93,6 +119,8 @@ David Vierra
Daw-Ran Liou
Debi Mishra
Denis Kirisov
Denivy Braiam Rück
Dheeraj C K
Dhiren Serai
Diego Russo
Dmitry Dygalo
@@ -103,27 +131,42 @@ Edison Gustavo Muenz
Edoardo Batini
Edson Tadeu M. Manoel
Eduardo Schettino
Edward Haigh
Eero Vaher
Eli Boyarski
Elizaveta Shashkova
Éloi Rivard
Endre Galaczi
Eric Hunsberger
Eric Liu
Eric Siegerman
Eric Yuan
Erik Aronesty
Erik Hasse
Erik M. Bray
Evan Kepner
Evgeny Seliverstov
Fabian Sturm
Fabien Zarifian
Fabio Zadrozny
Farbod Ahmadian
faph
Felix Hofstätter
Felix Nieuwenhuizen
Feng Ma
Florian Bruhin
Florian Dahlitz
Floris Bruynooghe
Fraser Stark
Gabriel Landau
Gabriel Reis
Garvit Shubham
Gene Wood
George Kussumoto
Georgy Dyuldin
Gergely Kalmár
Gleb Nikonorov
Graeme Smecher
Graham Horler
Greg Price
Gregory Lee
@@ -132,6 +175,7 @@ Grigorii Eremeev (budulianin)
Guido Wesdorp
Guoqiang Zhang
Harald Armin Massa
Harshna
Henk-Jaap Wagenaar
Holger Kohr
Hugo van Kemenade
@@ -140,11 +184,16 @@ Ian Bicking
Ian Lesperance
Ilya Konstantinov
Ionuț Turturică
Isaac Virshup
Israel Fruchter
Itxaso Aizpurua
Iwan Briquemont
Jaap Broekhuizen
Jake VanderPlas
Jakob van Santen
Jakub Mitoraj
James Bourbeau
James Frost
Jan Balster
Janne Vanhala
Jason R. Coombs
@@ -153,39 +202,51 @@ Javier Romero
Jeff Rackauckas
Jeff Widman
Jenni Rinker
Jens Tröger
John Eddie Ayson
John Litborn
John Towler
Jon Parise
Jon Sonesen
Jonas Obrist
Jordan Guymon
Jordan Moldow
Jordan Speicher
Joseph Hunkeler
Joseph Sawaya
Josh Karpel
Joshua Bronson
Jurko Gospodnetić
Justyna Janczyszyn
Justice Ndou
Justyna Janczyszyn
Kale Kundert
Kamran Ahmad
Kenny Y
Karl O. Pinc
Karthikeyan Singaravelan
Katarzyna Jachim
Katarzyna Król
Katerina Koukiou
Keri Volans
Kevin C
Kevin Cox
Kevin Hierro Carrasco
Kevin J. Foley
Kian Eliasi
Kian-Meng Ang
Kodi B. Arfer
Kojo Idrissa
Kostis Anagnostopoulos
Kristoffer Nordström
Kyle Altendorf
Lawrence Mitchell
Lee Kamentsky
Lev Maximov
Levon Saldamli
Lewis Cowles
Llandy Riveron Del Risco
Loic Esteve
lovetheguitar
Lukas Bednar
Luke Murphy
Maciek Fijalkowski
@@ -193,12 +254,16 @@ Maho
Maik Figura
Mandeep Bhutani
Manuel Krebber
Marc Mueller
Marc Schlaich
Marcelo Duarte Trevisani
Marcin Bachry
Marc Bresson
Marco Gorelli
Mark Abramowitz
Mark Dickinson
Mark Vong
Marko Pacak
Markus Unterwaditzer
Martijn Faassen
Martin Altmayer
@@ -212,30 +277,40 @@ Matthias Hafner
Maxim Filipenko
Maximilian Cosmo Sitter
mbyt
Mickey Pashov
Michael Aquilina
Michael Birtwell
Michael Droettboom
Michael Goerz
Michael Krebs
Michael Seifert
Michael Vogt
Michal Wajszczuk
Michał Górny
Michał Zięba
Mickey Pashov
Mihai Capotă
Mihail Milushev
Mike Hoyle (hoylemd)
Mike Lundy
Milan Lesnek
Miro Hrončok
mrbean-bremen
Nathan Goldbaum
Nathaniel Compton
Nathaniel Waisbrot
Ned Batchelder
Neil Martin
Neven Mundar
Nicholas Devenish
Nicholas Murphy
Niclas Olofsson
Nicolas Delaby
Nico Vidal
Nikolay Kondratyev
Olga Matoula
Nipunn Koorapati
Oleg Pidsadnyi
Oleg Sushchenko
Olga Matoula
Oliver Bestwalter
Omar Kohl
Omer Hadari
@@ -243,30 +318,39 @@ Ondřej Súkup
Oscar Benjamin
Parth Patel
Patrick Hayes
Patrick Lannigan
Paul Müller
Paul Reece
Pauli Virtanen
Pavel Karateev
Paweł Adamczak
Pedro Algarvio
Petter Strandmark
Philipp Loose
Pierre Sassoulas
Pieter Mulder
Piotr Banaszkiewicz
Piotr Helm
Poulami Sau
Prakhar Gurunani
Prashant Anand
Prashant Sharma
Pulkit Goyal
Punyashloka Biswal
Quentin Pradet
q0w
Ralf Schmitt
Ram Rachum
Ralph Giles
Ram Rachum
Ran Benita
Raphael Castaneda
Raphael Pierzina
Rafal Semik
Raquel Alegre
Ravi Chandra
Reagan Lee
Robert Holt
Roberto Aldera
Roberto Polli
Roland Puntaier
Romain Dorgueil
@@ -275,57 +359,85 @@ Ronny Pfannschmidt
Ross Lawley
Ruaridh Williamson
Russel Winder
Russell Martin
Ryan Puddephatt
Ryan Wooden
Sadra Barikbin
Saiprasad Kale
Samuel Colvin
Samuel Dion-Girardeau
Samuel Jirovec
Samuel Searles-Bryant
Samuel Therrien (Avasam)
Samuele Pedroni
Sanket Duthade
Sankt Petersbug
Saravanan Padmanaban
Sean Malloy
Segev Finer
Serhii Mozghovyi
Seth Junot
Shantanu Jain
Sharad Nair
Shubham Adep
Simon Blanchard
Simon Gomizelj
Simon Holesch
Simon Kerr
Skylar Downes
Srinivas Reddy Thatiparthy
Stefaan Lippens
Stefan Farmbauer
Stefan Scherfke
Stefan Zimmermann
Stefanie Molin
Stefano Taschini
Steffen Allner
Stephan Obermann
Sven-Hendrik Haase
Sviatoslav Sydorenko
Sylvain Marié
Tadek Teleżyński
Takafumi Arakaki
Taneli Hukkinen
Tanvi Mehta
Tanya Agarwal
Tarcisio Fischer
Tareq Alayan
Tatiana Ovary
Ted Xiao
Terje Runde
Thomas Grainger
Thomas Hisch
Tim Hoffmann
Tim Strazny
TJ Bruno
Tobias Diez
Tom Dalton
Tom Viner
Tomáš Gavenčiak
Tomer Keren
Tony Narlock
Tor Colvin
Trevor Bekolay
Tushar Sadhwani
Tyler Goodlet
Tyler Smart
Tzu-ping Chung
Vasily Kuznetsov
Victor Maryama
Victor Rodriguez
Victor Uriarte
Vidar T. Fauske
Vijay Arora
Virendra Patil
Virgil Dupras
Vitaly Lashmanov
Vivaan Verma
Vlad Dragos
Vlad Radziuk
Vladyslav Rachek
Volodymyr Kochetkov
Volodymyr Piskun
Wei Lin
Wil Cooley
@@ -335,8 +447,17 @@ Wouter van Ackooy
Xixi Zhao
Xuan Luong
Xuecong Liao
Yannick Péroux
Yao Xiao
Yoav Caspi
Yuliang Shao
Yusuke Kadowaki
Yutian Li
Yuval Shimon
Zac Hatfield-Dodds
Zach Snicker
Zachary Kneupper
Zachary OBrien
Zhouxin Qiu
Zoltán Máté
Zsolt Cserna

View File

@@ -1,14 +1,10 @@
============================
Contribution getting started
Contributing
============================
Contributions are highly welcomed and appreciated. Every little bit of help counts,
so do not hesitate!
.. contents::
:depth: 2
:backlinks: none
.. _submitfeedback:
@@ -50,6 +46,8 @@ Fix bugs
--------
Look through the `GitHub issues for bugs <https://github.com/pytest-dev/pytest/labels/type:%20bug>`_.
See also the `"good first issue" issues <https://github.com/pytest-dev/pytest/labels/good%20first%20issue>`_
that are friendly to new contributors.
:ref:`Talk <contact>` to developers to find out how you can fix specific bugs. To indicate that you are going
to work on a particular issue, add a comment to that effect on the specific issue.
@@ -126,7 +124,7 @@ For example:
Submitting Plugins to pytest-dev
--------------------------------
Pytest development of the core, some plugins and support code happens
Development of the pytest core, support code, and some plugins happens
in repositories living under the ``pytest-dev`` organisations:
- `pytest-dev on GitHub <https://github.com/pytest-dev>`_
@@ -195,11 +193,12 @@ Short version
~~~~~~~~~~~~~
#. Fork the repository.
#. Fetch tags from upstream if necessary (if you cloned only main `git fetch --tags https://github.com/pytest-dev/pytest`).
#. Enable and install `pre-commit <https://pre-commit.com>`_ to ensure style-guides and code checks are followed.
#. Follow **PEP-8** for naming and `black <https://github.com/psf/black>`_ for formatting.
#. Follow `PEP-8 <https://www.python.org/dev/peps/pep-0008/>`_ for naming.
#. Tests are run using ``tox``::
tox -e linting,py37
tox -e linting,py39
The test environments above are usually enough to cover most cases locally.
@@ -221,7 +220,7 @@ changes you want to review and merge. Pull requests are stored on
Once you send a pull request, we can discuss its potential modifications and
even add more commits to it later on. There's an excellent tutorial on how Pull
Requests work in the
`GitHub Help Center <https://help.github.com/articles/using-pull-requests/>`_.
`GitHub Help Center <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests>`_.
Here is a simple overview, with pytest-specific bits:
@@ -234,6 +233,7 @@ Here is a simple overview, with pytest-specific bits:
$ git clone git@github.com:YOUR_GITHUB_USERNAME/pytest.git
$ cd pytest
$ git fetch --tags https://github.com/pytest-dev/pytest
# now, create your own branch off "main":
$ git checkout -b your-bugfix-branch-name main
@@ -242,6 +242,11 @@ Here is a simple overview, with pytest-specific bits:
be released in micro releases whereas features will be released in
minor releases and incompatible changes in major releases.
You will need the tags to test locally, so be sure you have the tags from the main repository. If you suspect you don't, set the main repository as upstream and fetch the tags::
$ git remote add upstream https://github.com/pytest-dev/pytest
$ git fetch upstream --tags
If you need some help with Git, follow this quick start
guide: https://git.wiki.kernel.org/index.php/QuickStart
@@ -265,35 +270,35 @@ Here is a simple overview, with pytest-specific bits:
#. Run all the tests
You need to have Python 3.7 available in your system. Now
You need to have Python 3.8 or later available in your system. Now
running tests is as simple as issuing this command::
$ tox -e linting,py37
$ tox -e linting,py39
This command will run tests via the "tox" tool against Python 3.7
This command will run tests via the "tox" tool against Python 3.9
and also perform "lint" coding-style checks.
#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming.
#. You can now edit your local working copy and run the tests again as necessary. Please follow `PEP-8 <https://www.python.org/dev/peps/pep-0008/>`_ for naming.
You can pass different options to ``tox``. For example, to run tests on Python 3.7 and pass options to pytest
You can pass different options to ``tox``. For example, to run tests on Python 3.9 and pass options to pytest
(e.g. enter pdb on failure) to pytest you can do::
$ tox -e py37 -- --pdb
$ tox -e py39 -- --pdb
Or to only run tests in a particular test module on Python 3.7::
Or to only run tests in a particular test module on Python 3.9::
$ tox -e py37 -- testing/test_config.py
$ tox -e py39 -- testing/test_config.py
When committing, ``pre-commit`` will re-format the files if necessary.
#. If instead of using ``tox`` you prefer to run the tests directly, then we suggest to create a virtual environment and use
an editable install with the ``testing`` extra::
an editable install with the ``dev`` extra::
$ python3 -m venv .venv
$ source .venv/bin/activate # Linux
$ .venv/Scripts/activate.bat # Windows
$ pip install -e ".[testing]"
$ pip install -e ".[dev]"
Afterwards, you can edit the files and run pytest normally::
@@ -324,7 +329,7 @@ Here is a simple overview, with pytest-specific bits:
Writing Tests
~~~~~~~~~~~~~
Writing tests for plugins or for pytest itself is often done using the `pytester fixture <https://docs.pytest.org/en/stable/reference.html#pytester>`_, as a "black-box" test.
Writing tests for plugins or for pytest itself is often done using the `pytester fixture <https://docs.pytest.org/en/stable/reference/reference.html#pytester>`_, as a "black-box" test.
For example, to ensure a simple test passes you can write:
@@ -378,7 +383,7 @@ them.
Backporting bug fixes for the next patch release
------------------------------------------------
Pytest makes feature release every few weeks or months. In between, patch releases
Pytest makes a feature release every few weeks or months. In between, patch releases
are made to the previous feature release, containing bug fixes only. The bug fixes
usually fix regressions, but may be any change that should reach users before the
next feature release.
@@ -387,10 +392,17 @@ Suppose for example that the latest release was 1.2.3, and you want to include
a bug fix in 1.2.4 (check https://github.com/pytest-dev/pytest/releases for the
actual latest release). The procedure for this is:
#. First, make sure the bug is fixed the ``main`` branch, with a regular pull
#. First, make sure the bug is fixed in the ``main`` branch, with a regular pull
request, as described above. An exception to this is if the bug fix is not
applicable to ``main`` anymore.
Automatic method:
Add a ``backport 1.2.x`` label to the PR you want to backport. This will create
a backport PR against the ``1.2.x`` branch.
Manual method:
#. ``git checkout origin/1.2.x -b backport-XXXX`` # use the main PR number here
#. Locate the merge commit on the PR, in the *merged* message, for example:

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2004-2021 Holger Krekel and others
Copyright (c) 2004 Holger Krekel and others
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@@ -20,16 +20,13 @@
:target: https://codecov.io/gh/pytest-dev/pytest
:alt: Code coverage Status
.. image:: https://github.com/pytest-dev/pytest/workflows/main/badge.svg
:target: https://github.com/pytest-dev/pytest/actions?query=workflow%3Amain
.. image:: https://github.com/pytest-dev/pytest/actions/workflows/test.yml/badge.svg
:target: https://github.com/pytest-dev/pytest/actions?query=workflow%3Atest
.. image:: https://results.pre-commit.ci/badge/github/pytest-dev/pytest/main.svg
:target: https://results.pre-commit.ci/latest/github/pytest-dev/pytest/main
:alt: pre-commit.ci status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg
:target: https://www.codetriage.com/pytest-dev/pytest
@@ -37,6 +34,15 @@
:target: https://pytest.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://img.shields.io/badge/Discord-pytest--dev-blue
:target: https://discord.com/invite/pytest-dev
:alt: Discord
.. image:: https://img.shields.io/badge/Libera%20chat-%23pytest-orange
:target: https://web.libera.chat/#pytest
:alt: Libera chat
The ``pytest`` framework makes it easy to write small tests, yet
scales to support complex functional testing for applications and libraries.
@@ -79,21 +85,21 @@ Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` stat
Features
--------
- Detailed info on failing `assert statements <https://docs.pytest.org/en/stable/assert.html>`_ (no need to remember ``self.assert*`` names)
- Detailed info on failing `assert statements <https://docs.pytest.org/en/stable/how-to/assert.html>`_ (no need to remember ``self.assert*`` names)
- `Auto-discovery
<https://docs.pytest.org/en/stable/goodpractices.html#python-test-discovery>`_
<https://docs.pytest.org/en/stable/explanation/goodpractices.html#python-test-discovery>`_
of test modules and functions
- `Modular fixtures <https://docs.pytest.org/en/stable/fixture.html>`_ for
- `Modular fixtures <https://docs.pytest.org/en/stable/explanation/fixtures.html>`_ for
managing small or parametrized long-lived test resources
- Can run `unittest <https://docs.pytest.org/en/stable/unittest.html>`_ (or trial),
`nose <https://docs.pytest.org/en/stable/nose.html>`_ test suites out of the box
- Can run `unittest <https://docs.pytest.org/en/stable/how-to/unittest.html>`_ (or trial)
test suites out of the box
- Python 3.6+ and PyPy3
- Python 3.8+ or PyPy3
- Rich plugin architecture, with over 850+ `external plugins <https://docs.pytest.org/en/latest/reference/plugin_list.html>`_ and thriving community
- Rich plugin architecture, with over 1300+ `external plugins <https://docs.pytest.org/en/latest/reference/plugin_list.html>`_ and thriving community
Documentation
@@ -151,7 +157,7 @@ Tidelift will coordinate the fix and disclosure.
License
-------
Copyright Holger Krekel and others, 2004-2021.
Copyright Holger Krekel and others, 2004.
Distributed under the terms of the `MIT`_ license, pytest is free and open source software.

View File

@@ -37,7 +37,7 @@ breaking changes or new features.
For a new minor release, first create a new maintenance branch from ``main``::
git fetch --all
git fetch upstream
git branch 7.1.x upstream/main
git push upstream 7.1.x
@@ -63,7 +63,7 @@ Major releases
1. Create a new maintenance branch from ``main``::
git fetch --all
git fetch upstream
git branch 8.0.x upstream/main
git push upstream 8.0.x
@@ -133,32 +133,32 @@ Releasing
Both automatic and manual processes described above follow the same steps from this point onward.
#. After all tests pass and the PR has been approved, tag the release commit
in the ``release-MAJOR.MINOR.PATCH`` branch and push it. This will publish to PyPI::
#. After all tests pass and the PR has been approved, trigger the ``deploy`` job
in https://github.com/pytest-dev/pytest/actions/workflows/deploy.yml, using the ``release-MAJOR.MINOR.PATCH`` branch
as source.
git fetch --all
git tag MAJOR.MINOR.PATCH upstream/release-MAJOR.MINOR.PATCH
git push git@github.com:pytest-dev/pytest.git MAJOR.MINOR.PATCH
This job will require approval from ``pytest-dev/core``, after which it will publish to PyPI
and tag the repository.
Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_.
#. Merge the PR.
#. Merge the PR. **Make sure it's not squash-merged**, so that the tagged commit ends up in the main branch.
#. Cherry-pick the CHANGELOG / announce files to the ``main`` branch::
git fetch --all --prune
git fetch upstream
git checkout upstream/main -b cherry-pick-release
git cherry-pick -x -m1 upstream/MAJOR.MINOR.x
#. Open a PR for ``cherry-pick-release`` and merge it once CI passes. No need to wait for approvals if there were no conflicts on the previous step.
#. For major and minor releases, tag the release cherry-pick merge commit in main with
#. For major and minor releases (or the first prerelease of it), tag the release cherry-pick merge commit in main with
a dev tag for the next feature release::
git checkout main
git pull
git tag MAJOR.{MINOR+1}.0.dev0
git push git@github.com:pytest-dev/pytest.git MAJOR.{MINOR+1}.0.dev0
git push upstream MAJOR.{MINOR+1}.0.dev0
#. For major and minor releases, change the default version in the `Read the Docs Settings <https://readthedocs.org/dashboard/pytest/advanced/>`_ to the new branch.
#. Send an email announcement with the contents from::

View File

@@ -23,9 +23,9 @@ members of the `contributors team`_ interested in receiving funding.
The current list of contributors receiving funding are:
* `@asottile`_
* `@nicoddemus`_
* `@The-Compiler`_
* `@RonnyPfannschmidt`_
Contributors interested in receiving a part of the funds just need to submit a PR adding their
name to the list. Contributors that want to stop receiving the funds should also submit a PR
@@ -55,6 +55,6 @@ funds. Just drop a line to one of the `@pytest-dev/tidelift-admins`_ or use the
.. _`@pytest-dev/tidelift-admins`: https://github.com/orgs/pytest-dev/teams/tidelift-admins/members
.. _`agreement`: https://tidelift.com/docs/lifting/agreement
.. _`@asottile`: https://github.com/asottile
.. _`@nicoddemus`: https://github.com/nicoddemus
.. _`@The-Compiler`: https://github.com/The-Compiler
.. _`@RonnyPfannschmidt`: https://github.com/RonnyPfannschmidt

View File

@@ -1,12 +1,16 @@
from __future__ import annotations
import sys
if __name__ == "__main__":
import cProfile
import pytest # NOQA
import pstats
import pytest # noqa: F401
script = sys.argv[1:] if len(sys.argv) > 1 else ["empty.py"]
cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
cProfile.run(f"pytest.cmdline.main({script!r})", "prof")
p = pstats.Stats("prof")
p.strip_dirs()
p.sort_stats("cumulative")

View File

@@ -2,8 +2,11 @@
# 2.7.5 3.3.2
# FilesCompleter 75.1109 69.2116
# FastFilesCompleter 0.7383 1.0760
from __future__ import annotations
import timeit
imports = [
"from argcomplete.completers import FilesCompleter as completer",
"from _pytest._argcomplete import FastFilesCompleter as completer",

View File

@@ -1,2 +1,5 @@
from __future__ import annotations
for i in range(1000):
exec("def test_func_%d(): pass" % i)

View File

@@ -1,3 +1,5 @@
from __future__ import annotations
import pytest

View File

@@ -1,5 +1,8 @@
from __future__ import annotations
import pytest
SKIP = True

View File

@@ -1,5 +1,8 @@
from __future__ import annotations
from unittest import TestCase # noqa: F401
for i in range(15000):
exec(
f"""

View File

@@ -1,3 +1,6 @@
from __future__ import annotations
for i in range(5000):
exec(
f"""

34
changelog/.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
*
!.gitignore
!_template.rst
!README.rst
!*.bugfix
!*.bugfix.rst
!*.bugfix.*.rst
!*.breaking
!*.breaking.rst
!*.breaking.*.rst
!*.contrib
!*.contrib.rst
!*.contrib.*.rst
!*.deprecation
!*.deprecation.rst
!*.deprecation.*.rst
!*.doc
!*.doc.rst
!*.doc.*.rst
!*.feature
!*.feature.rst
!*.feature.*.rst
!*.improvement
!*.improvement.rst
!*.improvement.*.rst
!*.misc
!*.misc.rst
!*.misc.*.rst
!*.packaging
!*.packaging.rst
!*.packaging.*.rst
!*.vendor
!*.vendor.rst
!*.vendor.*.rst

View File

@@ -0,0 +1,4 @@
Fix reporting of teardown errors in higher-scoped fixtures when using `--maxfail` or `--stepwise`.
Originally added in pytest 8.0.0, but reverted in 8.0.2 due to a regression in pytest-xdist.
This regression was fixed in pytest-xdist 3.6.1.

View File

@@ -0,0 +1 @@
:func:`pytest.approx` now correctly handles :class:`Sequence <collections.abc.Sequence>`-like objects.

1
changelog/12153.doc.rst Normal file
View File

@@ -0,0 +1 @@
Documented using :envvar:`PYTEST_VERSION` to detect if code is running from within a pytest run.

View File

@@ -0,0 +1,11 @@
Fixed a regression in pytest 8.0 where tracebacks get longer and longer when multiple
tests fail due to a shared higher-scope fixture which raised -- by :user:`bluetech`.
Also fixed a similar regression in pytest 5.4 for collectors which raise during setup.
The fix necessitated internal changes which may affect some plugins:
* ``FixtureDef.cached_result[2]`` is now a tuple ``(exc, tb)``
instead of ``exc``.
* ``SetupState.stack`` failures are now a tuple ``(exc, tb)``
instead of ``exc``.

View File

@@ -0,0 +1,11 @@
Added `--xfail-tb` flag, which turns on traceback output for XFAIL results.
* If the `--xfail-tb` flag is not sent, tracebacks for XFAIL results are NOT shown.
* The style of traceback for XFAIL is set with `--tb`, and can be `auto|long|short|line|native|no`.
* Note: Even if you have `--xfail-tb` set, you won't see them if `--tb=no`.
Some history:
With pytest 8.0, `-rx` or `-ra` would not only turn on summary reports for xfail, but also report the tracebacks for xfail results. This caused issues with some projects that utilize xfail, but don't want to see all of the xfail tracebacks.
This change detaches xfail tracebacks from `-rx`, and now we turn on xfail tracebacks with `--xfail-tb`. With this, the default `-rx`/ `-ra` behavior is identical to pre-8.0 with respect to xfail tracebacks. While this is a behavior change, it brings default behavior back to pre-8.0.0 behavior, which ultimately was considered the better course of action.

1
changelog/12264.bugfix.rst Symbolic link
View File

@@ -0,0 +1 @@
12204.bugfix.rst

View File

@@ -0,0 +1 @@
Fix collection error upon encountering an :mod:`abstract <abc>` class, including abstract `unittest.TestCase` subclasses.

View File

@@ -0,0 +1,8 @@
Added support for keyword matching in marker expressions.
Now tests can be selected by marker keyword arguments.
Supported values are :class:`int`, (unescaped) :class:`str`, :class:`bool` & :data:`None`.
See :ref:`marker examples <marker_keyword_expression_example>` for more information.
-- by :user:`lovetheguitar`

View File

@@ -0,0 +1 @@
Fix a regression in pytest 8.0.0 where package-scoped parameterized items were not correctly reordered to minimize setups/teardowns in some cases.

View File

@@ -0,0 +1 @@
Fix crash with `assert testcase is not None` assertion failure when re-running unittest tests using plugins like pytest-rerunfailures. Regressed in 8.2.2.

View File

@@ -0,0 +1,3 @@
Migrated all internal type-annotations to the python3.10+ style by using the `annotations` future import.
-- by :user:`RonnyPfannschmidt`

6
changelog/12469.doc.rst Normal file
View File

@@ -0,0 +1,6 @@
The external plugin mentions in the documentation now avoid mentioning
:std:doc:`setuptools entry-points <setuptools:index>` as the concept is
much more generic nowadays. Instead, the terminology of "external",
"installed", or "third-party" plugins (or packages) replaces that.
-- by :user:`webknjaz`

View File

@@ -0,0 +1,4 @@
The console output now uses the "third-party plugins" terminology,
replacing the previously established but confusing and outdated
reference to :std:doc:`setuptools <setuptools:index>`
-- by :user:`webknjaz`.

View File

@@ -0,0 +1 @@
Fixed a crash when returning category ``"error"`` or ``"failed"`` with a custom test status from :hook:`pytest_report_teststatus` hook -- :user:`pbrezina`.

View File

@@ -0,0 +1,13 @@
The change log draft preview integration has been refactored to use a
third party extension ``sphinxcontib-towncrier``. The previous in-repo
script was putting the change log preview file at
:file:`doc/en/_changelog_towncrier_draft.rst`. Said file is no longer
ignored in Git and might show up among untracked files in the
development environments of the contributors. To address that, the
contributors can run the following command that will clean it up:
.. code-block:: console
$ git clean -x -i -- doc/en/_changelog_towncrier_draft.rst
-- by :user:`webknjaz`

View File

@@ -0,0 +1,5 @@
All the undocumented ``tox`` environments now have descriptions.
They can be listed in one's development environment by invoking
``tox -av`` in a terminal.
-- by :user:`webknjaz`

View File

@@ -0,0 +1,11 @@
The changelog configuration has been updated to introduce more accurate
audience-tailored categories. Previously, there was a ``trivial``
change log fragment type with an unclear and broad meaning. It was
removed and we now have ``contrib``, ``misc`` and ``packaging`` in
place of it.
The new change note types target the readers who are downstream
packagers and project contributors. Additionally, the miscellaneous
section is kept for unspecified updates that do not fit anywhere else.
-- by :user:`webknjaz`

View File

@@ -0,0 +1,7 @@
The UX of the GitHub automation making pull requests to update the
plugin list has been updated. Previously, the maintainers had to close
the automatically created pull requests and re-open them to trigger the
CI runs. From now on, they only need to click the `Ready for review`
button instead.
-- by :user:`webknjaz`

View File

@@ -0,0 +1 @@
Improve handling of invalid regex patterns in :func:`pytest.raises(match=r'...') <pytest.raises>` by providing a clear error message.

View File

@@ -0,0 +1,4 @@
The ``:pull:`` RST role has been replaced with a shorter
``:pr:`` due to starting to use the implementation from
the third-party :pypi:`sphinx-issues` Sphinx extension
-- by :user:`webknjaz`.

View File

@@ -0,0 +1,6 @@
The coverage reporting configuration has been updated to exclude
pytest's own tests marked as expected to fail from the coverage
report. This has an effect of reducing the influence of flaky
tests on the resulting number.
-- by :user:`webknjaz`

View File

@@ -0,0 +1,7 @@
The ``extlinks`` Sphinx extension is no longer enabled. The ``:bpo:``
role it used to declare has been removed with that. BPO itself has
migrated to GitHub some years ago and it is possible to link the
respective issues by using their GitHub issue numbers and the
``:issue:`` role that the ``sphinx-issues`` extension implements.
-- by :user:`webknjaz`

View File

@@ -0,0 +1,3 @@
The ``_in_venv()`` function now detects Python virtual environments by
checking for a :file:`pyvenv.cfg` file, ensuring reliable detection on
various platforms -- by :user:`zachsnickers`.

View File

@@ -0,0 +1 @@
12544.improvement.rst

View File

@@ -0,0 +1,2 @@
Possible typos in using the ``:user:`` RST role is now being linted
through the pre-commit tool integration -- by :user:`webknjaz`.

View File

@@ -0,0 +1 @@
Do not truncate arguments to functions in output when running with `-vvv`.

View File

@@ -0,0 +1,38 @@
The readability of assertion introspection of bound methods has been enhanced
-- by :user:`farbodahm`, :user:`webknjaz`, :user:`obestwalter`, :user:`flub`
and :user:`glyphack`.
Earlier, it was like:
.. code-block:: console
=================================== FAILURES ===================================
_____________________________________ test _____________________________________
def test():
> assert Help().fun() == 2
E assert 1 == 2
E + where 1 = <bound method Help.fun of <example.Help instance at 0x256a830>>()
E + where <bound method Help.fun of <example.Help instance at 0x256a830>> = <example.Help instance at 0x256a830>.fun
E + where <example.Help instance at 0x256a830> = Help()
example.py:7: AssertionError
=========================== 1 failed in 0.03 seconds ===========================
And now it's like:
.. code-block:: console
=================================== FAILURES ===================================
_____________________________________ test _____________________________________
def test():
> assert Help().fun() == 2
E assert 1 == 2
E + where 1 = fun()
E + where fun = <test_local.Help object at 0x1074be230>.fun
E + where <test_local.Help object at 0x1074be230> = Help()
test_local.py:13: AssertionError
=========================== 1 failed in 0.03 seconds ===========================

View File

@@ -1 +0,0 @@
Add automatically generated :ref:`plugin-list`. The list is updated on a periodic schedule.

View File

@@ -0,0 +1 @@
Fixed progress percentages (the ``[ 87%]`` at the edge of the screen) sometimes not aligning correctly when running with pytest-xdist ``-n``.

View File

@@ -1,7 +0,0 @@
Added :meth:`cache.mkdir() <pytest.Cache.mkdir>`, which is similar to the existing :meth:`cache.makedir() <pytest.Cache.makedir>`,
but returns a :class:`pathlib.Path` instead of a legacy ``py.path.local``.
Added a ``paths`` type to :meth:`parser.addini() <pytest.Parser.addini>`,
as in ``parser.addini("mypaths", "my paths", type="paths")``,
which is similar to the existing ``pathlist``,
but returns a list of :class:`pathlib.Path` instead of legacy ``py.path.local``.

View File

@@ -1,12 +0,0 @@
Directly constructing the following classes is now deprecated:
- ``_pytest.mark.structures.Mark``
- ``_pytest.mark.structures.MarkDecorator``
- ``_pytest.mark.structures.MarkGenerator``
- ``_pytest.python.Metafunc``
- ``_pytest.runner.CallInfo``
- ``_pytest._code.ExceptionInfo``
- ``_pytest.config.argparsing.Parser``
- ``_pytest.config.argparsing.OptionGroup``
These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0.

View File

@@ -1,19 +0,0 @@
The types of objects used in pytest's API are now exported so they may be used in type annotations.
The newly-exported types are:
- ``pytest.Config`` for :class:`Config <pytest.Config>`.
- ``pytest.Mark`` for :class:`marks <pytest.Mark>`.
- ``pytest.MarkDecorator`` for :class:`mark decorators <pytest.MarkDecorator>`.
- ``pytest.MarkGenerator`` for the :class:`pytest.mark <pytest.MarkGenerator>` singleton.
- ``pytest.Metafunc`` for the :class:`metafunc <pytest.MarkGenerator>` argument to the :func:`pytest_generate_tests <pytest.hookspec.pytest_generate_tests>` hook.
- ``pytest.CallInfo`` for the :class:`CallInfo <pytest.CallInfo>` type passed to various hooks.
- ``pytest.PytestPluginManager`` for :class:`PytestPluginManager <pytest.PytestPluginManager>`.
- ``pytest.ExceptionInfo`` for the :class:`ExceptionInfo <pytest.ExceptionInfo>` type returned from :func:`pytest.raises` and passed to various hooks.
- ``pytest.Parser`` for the :class:`Parser <pytest.Parser>` type passed to the :func:`pytest_addoption <pytest.hookspec.pytest_addoption>` hook.
- ``pytest.OptionGroup`` for the :class:`OptionGroup <pytest.OptionGroup>` type returned from the :func:`parser.addgroup <pytest.Parser.getgroup>` method.
Constructing them directly is not supported; they are only meant for use in type annotations.
Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.
Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.

View File

@@ -0,0 +1 @@
Added timezone information to the testsuite timestamp in the JUnit XML report.

View File

@@ -1,2 +0,0 @@
:ref:`--import-mode=importlib <import-modes>` now works with features that
depend on modules being on :py:data:`sys.modules`, such as :mod:`pickle` and :mod:`dataclasses`.

View File

@@ -1 +0,0 @@
Fixed failing staticmethod test cases if they are inherited from a parent test class.

View File

@@ -1,7 +0,0 @@
The following hooks now receive an additional ``pathlib.Path`` argument, equivalent to an existing ``py.path.local`` argument:
- :func:`pytest_ignore_collect <_pytest.hookspec.pytest_ignore_collect>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
- :func:`pytest_collect_file <_pytest.hookspec.pytest_collect_file>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
- :func:`pytest_pycollect_makemodule <_pytest.hookspec.pytest_pycollect_makemodule>` - The ``fspath`` parameter (equivalent to existing ``path`` parameter).
- :func:`pytest_report_header <_pytest.hookspec.pytest_report_header>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter).
- :func:`pytest_report_collectionfinish <_pytest.hookspec.pytest_report_collectionfinish>` - The ``startpath`` parameter (equivalent to existing ``startdir`` parameter).

View File

@@ -1,6 +0,0 @@
The following changes have been made to internal pytest types/functions:
- The ``path`` property of ``_pytest.code.Code`` returns ``Path`` instead of ``py.path.local``.
- The ``path`` property of ``_pytest.code.TracebackEntry`` returns ``Path`` instead of ``py.path.local``.
- The ``_pytest.code.getfslineno()`` function returns ``Path`` instead of ``py.path.local``.
- The ``_pytest.python.path_matches_patterns()`` function takes ``Path`` instead of ``py.path.local``.

View File

@@ -1,3 +0,0 @@
``testdir.makefile`` now silently accepts values which don't start with ``.`` to maintain backward compatibility with older pytest versions.
``pytester.makefile`` now issues a clearer error if the ``.`` is missing in the ``ext`` argument.

View File

@@ -1,7 +0,0 @@
Raising :class:`unittest.SkipTest` to skip collection of tests during the
pytest collection phase is deprecated. Use :func:`pytest.skip` instead.
Note: This deprecation only relates to using `unittest.SkipTest` during test
collection. You are probably not doing that. Ordinary usage of
:class:`unittest.SkipTest` / :meth:`unittest.TestCase.skipTest` /
:func:`unittest.skip` in unittest test cases is fully supported.

View File

@@ -1 +0,0 @@
``--version`` now writes version information to ``stdout`` rather than ``stderr``.

View File

@@ -1 +0,0 @@
Internal Restructure: let python.PyObjMixing inherit from nodes.Node to carry over typing information.

View File

@@ -1 +0,0 @@
Deprecate ``Node.fspath`` as we plan to move off `py.path.local <https://py.readthedocs.io/en/latest/path.html>`__ and switch to :mod:``pathlib``.

View File

@@ -1 +0,0 @@
Implement ``Node.path`` as a ``pathlib.Path``.

View File

@@ -1,3 +0,0 @@
Fixed issue where pytest's ``faulthandler`` support would not dump traceback on crashes
if the :mod:`faulthandler` module was already enabled during pytest startup (using
``python -X dev -m pytest`` for example).

View File

@@ -1,5 +0,0 @@
Several behaviors of :meth:`Parser.addoption <pytest.Parser.addoption>` are now
scheduled for removal in pytest 7 (deprecated since pytest 2.4.0):
- ``parser.addoption(..., help=".. %default ..")`` - use ``%(default)s`` instead.
- ``parser.addoption(..., type="int/string/float/complex")`` - use ``type=int`` etc. instead.

View File

@@ -1 +0,0 @@
Fixed an issue where illegal directory characters derived from ``getpass.getuser()`` raised an ``OSError``.

View File

@@ -1,10 +0,0 @@
Improved :func:`pytest.approx` assertion messages for sequences of numbers.
The assertion messages now dumps a table with the index and the error of each diff.
Example::
> assert [1, 2, 3, 4] == pytest.approx([1, 3, 3, 5])
E assert comparison failed for 2 values:
E Index | Obtained | Expected
E 1 | 2 | 3 +- 3.0e-06
E 3 | 4 | 5 +- 5.0e-06

View File

@@ -1 +0,0 @@
Recommend `numpy.testing <https://numpy.org/doc/stable/reference/routines.testing.html>`__ module on :func:`pytest.approx` documentation.

View File

@@ -1 +0,0 @@
Fix ``Class.from_parent`` so it forwards extra keyword arguments to the constructor.

View File

@@ -1 +0,0 @@
The ``@pytest.mark.skip`` decorator now correctly handles its arguments. When the ``reason`` argument is accidentally given both positional and as a keyword (e.g. because it was confused with ``skipif``), a ``TypeError`` now occurs. Before, such tests were silently skipped, and the positional argument ignored. Additionally, ``reason`` is now documented correctly as positional or keyword (rather than keyword-only).

View File

@@ -1 +0,0 @@
Use private names for internal fixtures that handle classic setup/teardown so that they don't show up with the default ``--fixtures`` invocation (but they still show up with ``--fixtures -v``).

View File

@@ -1,5 +0,0 @@
By default, pytest will truncate long strings in assert errors so they don't clutter the output too much,
currently at ``240`` characters by default.
However, in some cases the longer output helps, or is even crucial, to diagnose a failure. Using ``-v`` will
now increase the truncation threshold to ``2400`` characters, and ``-vv`` or higher will disable truncation entirely.

View File

@@ -1 +0,0 @@
Assert the outcomes for the issue 518 test and fix the test.

View File

@@ -1 +0,0 @@
:func:`pytest.approx` now works on :class:`~decimal.Decimal` within mappings/dicts and sequences/lists.

View File

@@ -1,4 +0,0 @@
Defining a custom pytest node type which is both an item and a collector now issues a warning.
It was never sanely supported and triggers hard to debug errors.
Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example.

View File

@@ -1 +0,0 @@
The :confval:`required_plugins` config option now works correctly when pre-releases of plugins are installed, rather than falsely claiming that those plugins aren't installed at all.

View File

@@ -1 +0,0 @@
``-c <config file>`` now also properly defines ``rootdir`` as the directory that contains ``<config file>``.

View File

@@ -1 +0,0 @@
Python 3.10 is now supported.

View File

@@ -1,4 +0,0 @@
:meth:`pytest.MonkeyPatch.syspath_prepend` no longer fails when
``setuptools`` is not installed.
It now only calls :func:`pkg_resources.fixup_namespace_packages` if
``pkg_resources`` was previously imported, because it is not needed otherwise.

View File

@@ -1,5 +0,0 @@
Fixed issue where `TestCase.setUpClass` is not called when a test has `/` in its name since pytest 6.2.0.
This refers to the path part in pytest node IDs, e.g. `TestClass::test_it` in the node ID `tests/test_file.py::TestClass::test_it`.
Now, instead of assuming that the test name does not contain ``/``, it is assumed that test path does not contain ``::``. We plan to hopefully make both of these work in the future.

View File

@@ -1 +0,0 @@
Introduce fix to handle precision width in ``log-cli-format`` in turn to fix output coloring for certain formats.

View File

@@ -1,5 +0,0 @@
pytest invocations with ``--fixtures-per-test`` and ``--fixtures`` have been enabled with:
- Fixture location path printed with the fixture name.
- First section of the fixture's docstring printed under the fixture name.
- Whole of fixture's docstring printed under the fixture name using ``--verbose`` option.

View File

@@ -1,4 +0,0 @@
Reducing confusion from `pytest.warns(None)` by:
- Allowing no arguments to be passed in order to catch any exception (no argument defaults to `Warning`).
- Emit a deprecation warning if passed `None`.

View File

@@ -1 +0,0 @@
Help text for ``--pdbcls`` more accurately reflects the option's behavior.

View File

@@ -1 +0,0 @@
New :ref:`version-tuple` attribute, which makes it simpler for users to do something depending on the pytest version (such as declaring hooks which are introduced in later versions).

View File

@@ -14,16 +14,28 @@ Each file should be named like ``<ISSUE>.<TYPE>.rst``, where
``<ISSUE>`` is an issue number, and ``<TYPE>`` is one of:
* ``feature``: new user facing features, like new command-line options and new behavior.
* ``improvement``: improvement of existing functionality, usually without requiring user intervention (for example, new fields being written in ``--junitxml``, improved colors in terminal, etc).
* ``improvement``: improvement of existing functionality, usually without requiring user intervention (for example, new fields being written in ``--junit-xml``, improved colors in terminal, etc).
* ``bugfix``: fixes a bug.
* ``doc``: documentation improvement, like rewording an entire session or adding missing docs.
* ``deprecation``: feature deprecation.
* ``breaking``: a change which may break existing suites, such as feature removal or behavior change.
* ``vendor``: changes in packages vendored in pytest.
* ``trivial``: fixing a small typo or internal change that might be noteworthy.
* ``packaging``: notes for downstreams about unobvious side effects
and tooling. changes in the test invocation considerations and
runtime assumptions.
* ``contrib``: stuff that affects the contributor experience. e.g.
Running tests, building the docs, setting up the development
environment.
* ``misc``: changes that are hard to assign to any of the above
categories.
So for example: ``123.feature.rst``, ``456.bugfix.rst``.
.. tip::
See :file:`pyproject.toml` for all available categories
(``tool.towncrier.type``).
If your PR fixes an issue, use that number here. If there is no issue,
then after you submit the PR and get the PR number you can add a
changelog using that instead.

View File

@@ -1,4 +1,9 @@
# reference: https://docs.codecov.io/docs/codecovyml-reference
---
codecov:
token: 1eca3b1f-31a2-4fb8-a8c3-138b441b50a7 #repo token
coverage:
status:
patch: true

View File

@@ -34,6 +34,10 @@ REGENDOC_ARGS := \
regen: REGENDOC_FILES:=*.rst */*.rst
regen:
PYTHONDONTWRITEBYTECODE=1 PYTEST_ADDOPTS="-pno:hypothesis -Wignore::pytest.PytestUnknownMarkWarning" COLUMNS=76 regendoc --update ${REGENDOC_FILES} ${REGENDOC_ARGS}
# need to reset cachedir to the non-tox default
PYTHONDONTWRITEBYTECODE=1 \
PYTEST_ADDOPTS="-pno:hypothesis -p no:hypothesispytest -Wignore::pytest.PytestUnknownMarkWarning -o cache_dir=.pytest_cache" \
COLUMNS=76 \
regendoc --update ${REGENDOC_FILES} ${REGENDOC_ARGS}
.PHONY: regen

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -17,7 +17,6 @@
<li><a href="{{ pathto('changelog') }}">Changelog</a></li>
<li><a href="{{ pathto('contributing') }}">Contributing</a></li>
<li><a href="{{ pathto('backwards-compatibility') }}">Backwards Compatibility</a></li>
<li><a href="{{ pathto('py27-py34-deprecation') }}">Python 2.7 and 3.4 Support</a></li>
<li><a href="{{ pathto('sponsor') }}">Sponsor</a></li>
<li><a href="{{ pathto('tidelift') }}">pytest for Enterprise</a></li>
<li><a href="{{ pathto('license') }}">License</a></li>
@@ -30,5 +29,3 @@
{%- endif %}
<hr>
<a href="{{ pathto('genindex') }}">Index</a>
<hr>

View File

@@ -0,0 +1,7 @@
<style>
.logo {text-align: center;}
</style>
<a class="logo" href="{{ pathto('contents') }}">
<img src="{{ pathto('_static/pytest1.png', 1) }}" width="70%" height="70%" text="Pytest Logo"/>
</a>

Some files were not shown because too many files have changed in this diff Show More