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 97960bdd148972b2f26bd9b336163e590bbc4c6b)
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