Adam J. Stewart
3b5b3cf50e
monkeypatch: add support for TypedDict ( #11000 )
2023-05-14 22:17:00 +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
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
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
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
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
819f5abd73
testing: remove usages of testdir that sneaked back in
2023-04-16 19:18:50 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Teejay
5dbfb8e108
Fix fixtures named teardown being considered by nose ( #10696 )
...
Closes #10597
2023-01-27 14:33:46 -03:00
Jay
ca40380e99
Add check for zero denominator in approx ( #10624 )
...
Closes #10533
2023-01-24 07:07:42 -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
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
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
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
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
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
s-padmanaban
8efb4bb9c1
Do not update cache from xdist worker ( #10641 )
2023-01-13 07:14:52 -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
Yusuke Kadowaki
10220d3f31
Change the default policy to all
2022-12-25 00:18:38 +09:00