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
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
Ran Benita
bf47357511
Merge pull request #10881 from pytest-dev/release-7.3.0
...
Prepare release 7.3.0
(cherry picked from commit cec5bfe0588adaa2ca36c72c724378982db6410a)
2023-04-09 00:50:37 +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
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
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
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
Bruno Oliveira
517e02e59e
Merge pull request #10792 from pytest-dev/release-7.2.2
...
Prepare release 7.2.2
(cherry picked from commit 3ce6030f0cc0e6fb18cbee1a4a8b1cec8c6d0b0c)
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
?plain=1#L18-L21
2023-03-03 12:53:38 -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
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
rdb
c237297b3d
Fix OSError in tmpdir on emscripten due to missing getuid()
...
Fixes #10765
2023-02-24 23:23:44 +01:00
bitzge
051f8f1f0f
Add CI and BUILD_NUMBER env var in docs ( #10749 )
2023-02-18 18:52:14 -03:00
Garvit Shubham
aa72496d24
Fix entry-points declaration in the documentation example using Hatch
...
Closes #10721
2023-02-14 10:57:32 -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
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
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
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
Bruno Oliveira
b2ac31cc9f
Merge pull request #10659 from pytest-dev/release-7.2.1
...
Prepare release 7.2.1
(cherry picked from commit 94c05bc2a489a3d6eb5cb47991741f8a61bb4099)
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
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
Yusuke Kadowaki
10220d3f31
Change the default policy to all
2022-12-25 00:18:38 +09:00
Pierre Sassoulas
b31db4809b
Avoid truncation when truncating means longer output ( #10446 )
...
Fixes #6267
2022-12-17 10:24:46 -03:00
Marko Pacak
9fbd67dd4b
Class methods can now be discovered as tests ( #10552 )
...
Fix #10525
2022-12-02 15:53:04 +00: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
Daniel Valenzuela
791b51d0fa
Show test name when skipping from fixture ( #10482 )
...
Fixes #10457
2022-11-18 09:20:38 -03: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
Hugo van Kemenade
0314b50c52
Fix 'importlib.abc.TraversableResources' deprecation warning in Python 3.12 ( #10452 )
2022-10-31 12:49:51 -03: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 ac4e3cced9fb1df60df271cce308f07713764857)
2022-10-25 13:12:55 +02: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
Anthony Sottile
d543a45a68
add deprecation changelog for py library vendoring
2022-10-21 12:46:15 -04: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
Gabriel Landau
f3d7e984ab
Changelog
2022-10-14 13:58:59 -04: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
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