Ran Benita
6c89f9261c
Remove deprecated py.path (`fspath`) node constructor arguments
2024-01-03 14:29:45 +02:00
Ran Benita
a98f02d423
Remove deprecated py.path hook arguments
2024-01-03 14:29:42 +02:00
Ran Benita
0f18a7fe5e
Remove deprecated nose support
2024-01-02 12:20:47 +02:00
Ran Benita
0591569b4b
Remove deprecated pytest.{exit,fail,skip}(msg=...) argument
2024-01-02 12:20:47 +02:00
Ran Benita
477959ef7d
Remove deprecated `pytest.Instance` backward compat
2024-01-02 12:20:47 +02:00
Ran Benita
4147c92b21
Remove deprecated `pytest.warns(None)`
2024-01-02 12:20:47 +02:00
Ran Benita
10fbb2325f
Remove deprecated `Parser.addoption` backward compatibilities
2024-01-02 12:20:47 +02:00
Ran Benita
1f8b39ed32
Remove deprecated `--strict` option
2024-01-02 12:20:47 +02:00
Ran Benita
f4e7b0d6e0
Remove deprecated `pytest_cmdline_preparse` hook
2024-01-02 12:20:47 +02:00
Ran Benita
f13724e2e3
Remove deprecated {FSCollector,Package}.{gethookproxy,isinitpath}
2024-01-02 12:20:47 +02:00
Ran Benita
d220880924
nodes: fix tracebacks from collection errors are not getting pruned ( #11711 )
...
Fix #11710 .
2023-12-31 10:14:23 +02:00
Ran Benita
a71a95b54c
Change "Marks applied to fixtures" removal from 8 to 9
...
The deprecation has only been added in 8.0, so can't be removed in 8.
That will have to wait for 9.
2023-12-30 22:14:40 +02:00
Ran Benita
acd445a3f3
Merge pull request #11646 from bluetech/pkg-collect
...
Rework Session and Package collection
2023-12-30 12:51:48 +02:00
Michał Górny
52db918a27
Fix handling empty values of NO_COLOR and FORCE_COLOR ( #11712 )
...
* Fix handling empty values of NO_COLOR and FORCE_COLOR
Fix handling NO_COLOR and FORCE_COLOR environment variables to correctly
be ignored when they are set to an empty value, as defined
in the specification:
> Command-line software which adds ANSI color to its output by default
> should check for a NO_COLOR environment variable that, when present
> *and not an empty string* (regardless of its value), prevents
> the addition of ANSI color.
(emphasis mine, https://no-color.org/ )
The same is true of FORCE_COLOR, https://force-color.org/ .
* Streamline testing for FORCE_COLOR and NO_COLOR
Streamline the tests for FORCE_COLOR and NO_COLOR variables, and cover
all possible cases (unset, set to empty, set to "1"). Combine the two
assert functions into one taking boolean parameters. Mock file.isatty
in all circumstances to ensure that the environment variables take
precedence over the fallback value resulting from isatty check (or that
the fallback is actually used, in the case of both FORCE_COLOR
and NO_COLOR being unset).
2023-12-23 10:12:13 +02:00
Benjamin Schubert
88ae27da08
Add syntactic highlights to the error explanations ( #11661 )
...
* Put a 'reset' color in front of the highlighting
When doing the highlighting, some lexers will not set the initial color
explicitly, which may lead to the red from the errors being propagated
to the start of the expression
* Add syntactic highlighting to the error explanations
This updates the various error reporting to highlight python code when
displayed, to increase readability and make it easier to understand
2023-12-21 17:11:56 +00:00
dependabot[bot]
7541c5a999
build(deps): Bump anyio[curio,trio] in /testing/plugins_integration ( #11717 )
...
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio ) from 4.1.0 to 4.2.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/4.1.0...4.2.0 )
---
updated-dependencies:
- dependency-name: anyio[curio,trio]
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-12-18 06:33:59 +01:00
dependabot[bot]
dfc910ee90
build(deps): Bump django from 4.2.7 to 5.0 in /testing/plugins_integration ( #11692 )
...
* build(deps): Bump django in /testing/plugins_integration
Bumps [django](https://github.com/django/django ) from 4.2.7 to 5.0.
- [Commits](https://github.com/django/django/compare/4.2.7...5.0 )
---
updated-dependencies:
- dependency-name: django
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump python version on the plugin job
https://github.com/pytest-dev/pytest/pull/11692#issuecomment-1849963332
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
2023-12-11 14:18:43 +00:00
dependabot[bot]
ef8bf82a78
build(deps): Bump pytest-asyncio in /testing/plugins_integration ( #11693 )
...
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio ) from 0.23.1 to 0.23.2.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases )
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.1...v0.23.2 )
---
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>
2023-12-11 09:24:52 +01:00
Ran Benita
385796ba49
Rework Session and Package collection
...
Fix #7777 .
2023-12-10 17:01:39 +02:00
Ran Benita
0ae02e2165
nodes,python: mark abstract node classes as ABCs
...
Fixes #11676
2023-12-07 16:41:07 +02:00
Benjamin Schubert
a536f49d91
Separate the various parts of the error report with newlines ( #11659 )
...
Previously the error report would have all sections glued together:
- The assertion representation
- The error explanation
- The full diff
This makes it hard to see at a glance where which one starts and ends.
One of the representation (dataclasses, tuples, attrs) does display a
newlines at the start already.
Let's add a newlines before the error explanation and before the full
diff, so we get an easier to read report.
This has one disadvantage: we get one line less in the least verbose
mode, where the output gets truncated.
2023-12-06 09:25:00 +00:00
dependabot[bot]
022f1b4de5
build(deps): Bump pytest-bdd in /testing/plugins_integration ( #11665 )
...
Bumps [pytest-bdd](https://github.com/pytest-dev/pytest-bdd ) from 7.0.0 to 7.0.1.
- [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/7.0.0...7.0.1 )
---
updated-dependencies:
- dependency-name: pytest-bdd
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>
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2023-12-04 13:58:18 +00:00
dependabot[bot]
db8c6f1da8
build(deps): Bump pytest-asyncio in /testing/plugins_integration ( #11664 )
...
Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio ) from 0.21.1 to 0.23.1.
- [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases )
- [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.21.1...v0.23.1 )
---
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-12-04 10:41:34 -03:00
Ran Benita
ef699f8c17
testing: remove a no longer necessary skip
...
pytest-xdist was released at 2019-02-15, seems enough time.
2023-11-30 19:53:31 +02:00
Ran Benita
968510b6aa
testing: fix isolation issue in `tr` fixture
...
The default for `_prepareconfig` is to use `sys.argv`, which in this
case are the flags passed to (top-level) `pytest`. This is not the
intention, the tests themselves should not be affected by it.
2023-11-28 19:54:24 +02:00
Ran Benita
ad1bccdead
pytester: avoid EncodingWarning from `locale.getpreferredencoding`
...
When running `tox -e py-lsof` I get a deluge of this warning:
```
src/pytest/.tox/py-lsof-numpy-pexpect/lib/python3.11/site-packages/_pytest/pytester.py:130: EncodingWarning: UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.
```
Use `locale.getencoding` instead.
2023-11-28 17:40:58 +02:00
Benjamin Schubert
2d1710e0e9
Improve the full diff by having more consistent indentation in the PrettyPrinter ( #11571 )
...
The normal default pretty printer is not great when objects are nested
and it can get hard to read the diff.
Instead, provide a pretty printer that behaves more like when json get
indented, which allows for smaller, more meaningful differences, at
the expense of a slightly longer diff.
This does not touch the other places where the pretty printer is used,
and only updated the full diff one.
2023-11-27 16:47:18 +02:00
Ran Benita
fe8cda051b
Merge pull request #11642 from pytest-dev/dependabot/pip/testing/plugins_integration/anyio-curiotrio--4.1.0
...
build(deps): Bump anyio[curio,trio] from 4.0.0 to 4.1.0 in /testing/plugins_integration
2023-11-27 10:22:45 +02:00
dependabot[bot]
6053bb8d6a
build(deps): Bump anyio[curio,trio] in /testing/plugins_integration
...
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio ) from 4.0.0 to 4.1.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/4.0.0...4.1.0 )
---
updated-dependencies:
- dependency-name: anyio[curio,trio]
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 03:05:25 +00:00
dependabot[bot]
03220f7c9e
build(deps): Bump pytest-rerunfailures in /testing/plugins_integration
...
Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures ) from 12.0 to 13.0.
- [Changelog](https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst )
- [Commits](https://github.com/pytest-dev/pytest-rerunfailures/compare/12.0...13.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-11-27 03:05:20 +00:00
Michał Górny
85e0f676c5
Reset color-related envvars for testing ( #11638 )
...
Reset color-related environment variables in a fixture to prevent them
from affecting test results. Otherwise, some of the tests fail
e.g. if NO_COLOR is set in the calling environment.
2023-11-26 11:09:18 -03:00
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