Ran Benita
14a879b6d1
Merge pull request #9183 from bluetech/rm-redundent-osfspath
...
Remove redundant explicit os.fspath calls
2021-10-09 19:14:55 +03:00
Bernát Gábor
3407fe63e2
Support the importlib.resources files API in rewritten files ( #9173 )
2021-10-09 10:54:44 -03:00
Ran Benita
7eee5c1634
Change `Node.reportinfo()` return value from `py.path` to `str|os.PathLike[str]`
...
`reportinfo()` is the last remaining py.path-only code path in pytest,
i.e. the last piece holding back py.path deprecation. The problem with
it is that plugins/users use it from both sides -- implementing it
(returning the value) and using it (using the return value). Dealing
with implementers is easy enough -- allow to return `os.PathLike[str]`.
But for callers who expect strictly `py.path` this will break and
there's not really a good way to provide backward compat for this.
From analyzing a corpus of 680 pytest plugins, the vast majority of
`reportinfo` appearances are implementations, and the few callers don't
actually access the path part of the return tuple.
As for test suites that might access `reportinfo` (e.g. using
`request.node.reportinfo()` or other ways), that is much harder to
survey, but from the ones I searched, I only found case
(`pytest_teamcity`, but even then it uses `str(fspath)` so is unlikely
to be affected in practice). They are better served with using
`node.location` or `node.path` directly.
Therefore, just break it and change the return type to
`str|os.PathLike[str]`.
Refs #7259 .
2021-10-09 15:02:03 +03:00
Ran Benita
5059b31a73
Remove redundant explicit os.fspath calls
...
Python calls it on its own.
2021-10-09 13:44:44 +03:00
Jeff Rasley
e84ba80301
Update pastebin URL from bpaste to bpa.st ( #9131 )
2021-10-06 08:12:48 -03:00
Ran Benita
e077f1cbd5
Merge pull request #9168 from bluetech/node-keywords-dups
...
mark/structures: fix NodeKeywords.{__iter__,__len__} given duplicates
2021-10-06 12:01:05 +03:00
Ran Benita
cf4495ffe1
mark/structures: fix NodeKeywords.{__iter__,__len__} given duplicates
...
Regressed in c4b9b14a4
-- the `set` stuff had a reason which I had
missed.
2021-10-06 11:24:28 +03:00
Ran Benita
c9267af3bf
Merge pull request #9166 from bluetech/optimize-imply-path
...
nodes: micro-optimize _imply_path
2021-10-06 10:50:10 +03:00
Ran Benita
076ac901bb
nodes: micro-optimize _imply_path
2021-10-06 10:29:52 +03:00
Bruno Oliveira
14b79a66a3
Merge pull request #9025 from davidszotten/more_verbose_for_ci
2021-10-05 16:52:47 -03:00
Bruno Oliveira
9546fb713a
Merge pull request #9066 from eamanu/fix-8994
2021-10-05 16:52:08 -03:00
Bruno Oliveira
fb52fc5163
Merge pull request #9070 from andrewdotn/main
2021-10-05 16:51:58 -03:00
Bruno Oliveira
459e10b802
Merge pull request #9133 from okken/9113_deselected_assert_outcomes
2021-10-05 16:50:42 -03:00
Ran Benita
d0bdc26490
Merge pull request #9164 from bluetech/optimize-keywords
...
mark/structures: micro-optimize item.keywords/NodeKeywords
2021-10-05 20:03:42 +03:00
Ran Benita
c4b9b14a44
mark/structures: micro-optimize item.keywords/NodeKeywords
2021-10-05 16:50:22 +03:00
Ran Benita
54811b24e2
Merge pull request #9163 from bluetech/rewrite-end-lineno
...
rewrite: fixup end_lineno, end_col_offset of rewritten asserts
2021-10-05 16:46:29 +03:00
Ran Benita
6a5211f369
rewrite: fixup end_lineno, end_col_offset of rewritten asserts
...
These are new additions in Python 3.8:
https://docs.python.org/3/whatsnew/3.8.html#ast
I'm not sure what's using them but we should set them anyway.
2021-10-05 10:51:09 +03:00
Brian Okken
c82bda259c
Add a `pythonpath` setting to allow paths to be added to `sys.path`. ( #9134 )
2021-10-05 09:36:38 +03:00
Bruno Oliveira
05a97375fd
Merge pull request #9162 from pytest-dev/pre-commit-ci-update-config
2021-10-04 18:55:29 -03:00
Zac Hatfield-Dodds
e763fde482
Merge pull request #9158 from hoefling/doc/internal-crossrefs
...
replace hardcoded urls to docs.pytest.org with internal crossrefs, add crossrefs to numpy docs, use sphinx pep role
2021-10-05 08:43:19 +11:00
pre-commit-ci[bot]
1a8b4343ff
[pre-commit.ci] pre-commit autoupdate
...
updates:
- [github.com/asottile/pyupgrade: v2.28.0 → v2.29.0](https://github.com/asottile/pyupgrade/compare/v2.28.0...v2.29.0 )
2021-10-04 19:49:14 +00:00
Ran Benita
483f239d01
Merge pull request #9161 from bluetech/attrs-auto
...
Use attr.s(auto_attribs=True) in more places
2021-10-04 21:59:52 +03:00
oleg.hoefling
3926526c95
revert changes in doc/en/announce
...
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-10-04 20:06:13 +02:00
Ronny Pfannschmidt
028eb6fab6
Merge pull request #9115 from RonnyPfannschmidt/fix-regendoc
...
fix #8818 - run regendoc without tox cachedir
2021-10-04 19:11:45 +02:00
Ran Benita
e5468681b0
Use attr.s(auto_attribs=True) in more places
...
It's nicer to read without the attr.ib noise.
2021-10-04 19:24:12 +03:00
Ran Benita
dced00e60f
Merge pull request #9154 from bluetech/refactor-callspec2
...
python: refactor CallSpec2
2021-10-04 18:56:29 +03:00
Ran Benita
570b1facb7
python: refactor CallSpec2
...
This type is semi-private; not documented but many plugins access it
through `item.callspec`. However, plugins access the public fields and
almost none try to construct or monkeypatch it. So we should be allowed
to clean it up some.
- Convert to attrs, add slots and frozen
- Instead of doing `new = old.copy(); new.setmulti2()`, do `new =
old.setmulti()`. This is cleaner and faster.
- Remove the `metafunc` attribute. This causes a reference cycle
(multifunc._calls -> callspec -> multifunc) for no good reason --
neither pytest itself or plugins access this attribute, so let's not
keep the Metafunc objects alive past their due.
- Some comments.
I would have also like to make the dicts and lists themselves immutable,
however some plugins mess with those so that should be done separately,
if at all.
2021-10-04 17:33:52 +03:00
Bruno Oliveira
c4557c3192
Merge pull request #9150 from nicoddemus/issue-9141-fixture-docs
2021-10-04 09:48:19 -03:00
Ran Benita
8a58b0c892
Merge pull request #9155 from pytest-dev/update-plugin-list/patch-0fbfd1ca3
...
[automated] Update plugin list
2021-10-04 10:46:16 +03:00
Ran Benita
73634ffb49
Merge pull request #9160 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-cov-3.0.0
...
build(deps): bump pytest-cov from 2.12.1 to 3.0.0 in /testing/plugins_integration
2021-10-04 10:45:21 +03:00
Ronny Pfannschmidt
c21ef7ba22
fix #8818 - run regendoc without tox cachedir
...
#4270 introduced per tox env pytest cachedirs and
never protected regendoc against it
2021-10-04 08:56:26 +02:00
dependabot[bot]
c061412a8b
build(deps): bump pytest-cov in /testing/plugins_integration
...
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov ) from 2.12.1 to 3.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases )
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.12.1...v3.0.0 )
---
updated-dependencies:
- dependency-name: pytest-cov
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
2021-10-04 03:01:33 +00:00
oleg.hoefling
d58ee2b677
replace hardcoded urls to docs.pytest.org with internal crossrefs, add external crossrefs where possible
...
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-10-04 00:23:41 +02:00
Ronny Pfannschmidt
35d8c1398c
Merge pull request #8134 from RonnyPfannschmidt/setuptools_scm_5
...
fixes #8133 : migrate to setuptools_scm 6.x
2021-10-03 20:46:00 +02:00
pytest bot
618ee0f268
[automated] Update plugin list
2021-10-03 00:11:19 +00:00
Ronny Pfannschmidt
0892c77bc6
fixes #8133 : mitigate regendoc issues wrt PRETEND_VERSION
...
this issues is less likely to hit due to the recent regendoc release
which includes a wheel
* migrate to setuptools_scm 6.3.2
* use SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST
2021-10-02 20:22:18 +02:00
Ran Benita
0fbfd1ca36
Merge pull request #9152 from bluetech/mark-optimize
...
mark/structures: slightly optimize some functions
2021-10-02 15:57:57 +03:00
Ran Benita
2cfce8d8c4
Merge pull request #9153 from bluetech/coverage-assert-never
...
coverage: add assert_never to exclude_lines
2021-10-02 15:56:24 +03:00
Ran Benita
1d0261e5cb
coverage: add assert_never to exclude_lines
...
These are assertions that should never trigger.
2021-10-02 14:26:04 +03:00
Ran Benita
637e8efdd4
mark/structures: slightly optimize some functions
...
`normalize_mark_list` shows up in pandas collection profiles. It's
simple enough to improve.
2021-10-02 14:06:52 +03:00
Bruno Oliveira
ac3614b999
Add note about fixture teardown and SIGTERM and SIGQUIT signals
...
Close #9141
2021-10-01 16:12:03 -03:00
Ran Benita
f65dfc39f3
Merge pull request #9123 from pytest-dev/update-plugin-list/patch-112204cf8
...
[automated] Update plugin list
2021-10-01 16:31:59 +03:00
Ran Benita
8af558723e
main: avoid Path(Path(...)) calls, they're slow ( #9147 )
2021-10-01 16:21:32 +03:00
Ran Benita
5fc3e35afb
Merge pull request #9144 from bluetech/py36_order_by_definition
...
py36+ tests are definition ordered [v2]
2021-10-01 16:17:37 +03:00
Ran Benita
d8831c64eb
Merge pull request #9148 from bluetech/lru-cache-method
...
Avoid `@lru_cache` on methods
2021-10-01 16:16:51 +03:00
Ran Benita
3a6eaa9c1c
Merge pull request #9145 from bluetech/compat-pattern
...
compat: replace REGEX_TYPE with typing.Pattern
2021-10-01 16:16:28 +03:00
Ran Benita
c86ceb4d01
main: avoid Path(Path(...)) calls, they're slow
2021-10-01 15:30:03 +03:00
Ran Benita
16e5fbe371
config: optimize PytestPluginManager._getconftestmodules
...
Now that it's no longer using `@lru_cache`, use another check to avoid
re-computation. Although `@lru_cache` is faster than the full function
call + checks, this approach also has the advantage that the caching
works for more than 128 entries.
2021-10-01 15:25:28 +03:00
Ran Benita
614f5394b5
Avoid `@lru_cache` on methods
...
The problem with `@lru_cache` on methods is that it also captures `self`
and leaks it until the entry is evicted (if ever).
2021-10-01 14:41:14 +03:00
Ran Benita
1f938e3ef5
compat: replace REGEX_TYPE with typing.Pattern
...
Since Python 3.7, there is `re.Pattern` for this, but since we need to
support Python 3.6, can use `typing.Pattern` which works as well.
2021-10-01 14:00:15 +03:00