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