Jens Tröger
acab13fcc9
Add new filtering() method to LogCaptureFixture class ( #11625 )
...
Fixes #11610
2023-11-24 09:38:34 -03: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
Patrick Lannigan
9dc1fc4523
Add verbosity_assertions and config.get_verbosity
...
Fixes #11387
2023-11-19 11:56:29 -03: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
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
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
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]
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
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
Bruno Oliveira
7156a97f9a
Fix crash using empty string for parametrized value more than once
...
Fixes #11563 .
2023-10-27 17:26:12 -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
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
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
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
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
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
Reagan Lee
9bbfe995ee
Add more comprehensive set assertion rewrites ( #11469 )
...
Fixes #10617
2023-10-02 18:37:52 -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
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
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
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
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
Aleksandr Brodin
a60c23c3d8
fix invalid signature
2023-09-11 09:59:00 +07: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
Sadra Barikbin
48b0395648
fixtures: clean up getfixtureclosure()
...
Some code cleanups - no functional changes.
2023-09-08 15:53:49 +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
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
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
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
Sean Malloy
19d6b12b2a
fix: fixing an issue with pre-commit with mypy and flake8
2023-08-27 15:03:42 -07: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
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
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