Cserna Zsolt
8a38e7a6e8
Fix handling recursive symlinks
...
When pytest was run on a directory containing a recursive symlink it failed
with ELOOP as the library was not able to determine the type of the
direntry:
src/_pytest/main.py:685: in collect
if not direntry.is_file():
E OSError: [Errno 40] Too many levels of symbolic links: '/home/florian/proj/pytest/tests/recursive'
This is fixed by handling ELOOP and other errors in the visit function in
pathlib.py, so the entries whose is_file() call raises an OSError with the
pre-defined list of error numbers will be exluded from the result.
The _ignore_errors function was copied from Lib/pathlib.py of cpython 3.9.
Fixes #7951
2020-10-31 17:40:56 +01:00
Christine M
8d369f73ba
Migrate test_skipping.py from testdir to pytester ( #7953 )
2020-10-28 17:05:54 +02:00
Ran Benita
78c09b9931
Merge pull request #7944 from symonk/refactor-test-mark-to-use-pytester
...
Refactor test_warning_types.py & test_mark.py to use pytester
2020-10-27 21:06:42 +02:00
symonk
434e30424e
Address feedback for converting testdir to pytester
2020-10-27 17:50:54 +00:00
Mikhail Fesenko
cd9b3618c7
#7942 test_helpconfig.py migrate from testdir to pytester
2020-10-26 18:30:48 +03:00
Ran Benita
c31f4dc112
testing: make conftest stuff check for pytester not testdir
...
testdir uses pytester so this applies to it as well, but now includes
pytester as well.
2020-10-26 15:01:38 +02:00
dependabot[bot]
f7c5067823
build(deps): bump pytest-django in /testing/plugins_integration
...
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django ) from 4.0.0 to 4.1.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.0.0...v4.1.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-10-26 03:15:50 +00:00
symonk
cde50db6e7
add type hint to parametrized warning_class
2020-10-25 18:31:43 +00:00
symonk
c818ac2248
Tidy up type hints for pytest in test_marks & test_warning_types
2020-10-25 18:03:59 +00:00
symonk
6b7203aba7
add conversion for test_warning_types.py also
2020-10-25 17:38:12 +00:00
symonk
7495d2c345
add missing pytester type hints
2020-10-25 17:33:40 +00:00
symonk
1bd83e75a4
refactor test mark to use new pytester
2020-10-25 17:27:19 +00:00
Ran Benita
897f151e94
testing: use pytester.spawn instead of testdir
...
Part of investigating a bug, but didn't fix it.
2020-10-25 10:11:10 +02:00
Ran Benita
25dee8fef6
testing: fix test_assertrewrite with PYTHONPYCACHEPREFIX
...
Make the tests work when running with PYTHONPYCACHEPREFIX (possible when
running in a dirty environment, not under tox).
2020-10-25 10:11:10 +02:00
Ran Benita
d9ac2efbcd
testing: python 3.10 fix
2020-10-25 01:27:44 +02:00
Ran Benita
d6becfa177
fixtures: change _getautousenames to an iterator
...
This reads better.
2020-10-25 00:49:06 +03:00
Ran Benita
aa0e2d654f
fixtures: use a faster replacement for ischildnode
...
ischildnode can be quite hot in some cases involving many fixtures.
However it is always used in a way that the nodeid is constant and the
baseid is iterated. So we can save work by pre-computing the parents of
the nodeid and use a simple containment test.
The `_getautousenames` function has the same stuff open-coded, so change
it to use the new function as well.
2020-10-25 00:48:35 +03:00
Ran Benita
0cdbf8b377
Merge pull request #7910 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-trio-0.7.0
...
build(deps): bump pytest-trio from 0.6.0 to 0.7.0 in /testing/plugins_integration
2020-10-23 16:52:54 +03:00
Ran Benita
e1848349a7
Merge pull request #7909 from pytest-dev/dependabot/pip/testing/plugins_integration/pytest-django-4.0.0
...
build(deps): bump pytest-django from 3.10.0 to 4.0.0 in /testing/plugins_integration
2020-10-23 16:52:29 +03:00
Ran Benita
afaabdda8c
cacheprovider: fix some files in packages getting lost from --lf
...
--lf has an optimization where it skips collecting Modules (python
files) which don't contain failing tests. The optimization works by
getting the paths of all cached failed tests and skipping the collection
of Modules whose path is not included in that list.
In pytest, Package nodes are Module nodes with the fspath being the file
`<package dir>/__init__.py`. Since it's a Module the logic above
triggered for it, and because it's an `__init__.py` file which is
unlikely to have any failing tests in it, it is skipped, which causes
its entire directory to be skipped, including any Modules inside it with
failing tests.
Fix by special-casing Packages to never filter. This means entire
Packages are never filtered, the Modules themselves are always checked.
It is reasonable to consider an optimization which does filter entire
packages bases on parent paths etc. but this wouldn't actually save any
real work so is really not worth it.
2020-10-19 19:02:43 +03:00
Hugo van Kemenade
c9e5042d6d
Remove redundant Python 2.7 code
2020-10-19 10:47:35 +03:00
Hugo van Kemenade
a642650e17
Drop support for EOL Python 3.5
2020-10-19 10:02:36 +03:00
dependabot[bot]
f335144d1d
build(deps): bump pytest-trio in /testing/plugins_integration
...
Bumps [pytest-trio](https://github.com/python-trio/pytest-trio ) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/python-trio/pytest-trio/releases )
- [Commits](https://github.com/python-trio/pytest-trio/compare/v0.6.0...v0.7.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-10-19 03:05:42 +00:00
dependabot[bot]
23aac10391
build(deps): bump pytest-django in /testing/plugins_integration
...
Bumps [pytest-django](https://github.com/pytest-dev/pytest-django ) from 3.10.0 to 4.0.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/v3.10.0...v4.0.0 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-10-19 03:05:42 +00:00
Ran Benita
1b23a111d2
Update mypy 0.782 -> 0.790
2020-10-17 19:25:45 +03:00
Bruno Oliveira
69419cb700
New pytester fixture ( #7854 )
2020-10-12 12:13:06 -03:00
dependabot[bot]
b53a8bb60f
build(deps): bump django in /testing/plugins_integration
...
Bumps [django](https://github.com/django/django ) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/django/django/releases )
- [Commits](https://github.com/django/django/compare/3.1.1...3.1.2 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-10-12 12:39:31 +00:00
dependabot[bot]
37cf4693cf
build(deps): bump anyio[curio,trio] in /testing/plugins_integration
...
Bumps [anyio[curio,trio]](https://github.com/agronholm/anyio ) from 2.0.0 to 2.0.2.
- [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/2.0.0...2.0.2 )
Signed-off-by: dependabot[bot] <support@github.com>
2020-10-10 15:52:11 +00:00
Hugo van Kemenade
3059caf1ee
Put smoke test deps in requirements.txt for Dependabot ( #7806 )
2020-10-10 18:51:35 +03:00
Kyle Altendorf
76acb44330
Update tests to cover explicit None and "string" as addini() types
2020-10-07 17:56:54 -04:00
Manuel Mariñez
13ddec9a00
Add alias clarification to deprecation warning ( #7829 )
...
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
2020-10-06 11:48:34 -03:00
Anthony Sottile
33d119f71a
py36+: com2ann
2020-10-05 18:33:17 -07:00
Anthony Sottile
f81c6c00a9
Merge pull request #7852 from asottile/py36_pyupgrade
...
py36+: pyupgrade: py36+
2020-10-04 08:25:32 -07:00
Ran Benita
bf09e7792f
fixtures: some type annotations
2020-10-04 09:43:58 +03:00
Anthony Sottile
66bd44c13a
py36+: pyupgrade: py36+
2020-10-03 12:46:54 -07:00
Anthony Sottile
fb1d550aac
py36+: remove rexport of Path and PurePath
2020-10-03 12:16:52 -07:00
Anthony Sottile
6ed07a1c25
Merge pull request #7840 from asottile/py36_typing_Type
...
py36+: from typing import Type: no longer need guard
2020-10-03 07:44:06 -07:00
Anthony Sottile
aa077ab188
Merge pull request #7841 from asottile/py36_todo
...
py36+: resolve py36 TODOs
2020-10-03 07:43:15 -07:00
Ran Benita
a6a7ba57e0
Merge pull request #7817 from bluetech/fix-testpaths-bestrelpath2
...
terminal: fix crash in header reporting when absolute testpaths is used
2020-10-03 12:59:18 +03:00
Anthony Sottile
53b5f64b4b
py36+: resolve py36 TODOs
2020-10-02 19:57:55 -07:00
Anthony Sottile
bfadd4060e
py36+: from typing import Type: no longer need guard
2020-10-02 19:50:10 -07:00
Anthony Sottile
a23666d554
Merge pull request #7838 from asottile/py36_requires_ordered_markup
...
py36+: remove requires_ordered_markup
2020-10-02 19:48:01 -07:00
Anthony Sottile
ac189885f6
Merge pull request #7835 from asottile/py36_misc
...
py36+: miscellaneous (3, 6) cleanup
2020-10-02 19:47:35 -07:00
Anthony Sottile
6ba13ed528
Merge pull request #7834 from asottile/py36_TYPE_CHECKING
...
py36+: remove TYPE_CHECKING from _pytest.compat
2020-10-02 19:47:27 -07:00
Anthony Sottile
daba7ceb71
py36+: remove requires_ordered_markup
2020-10-02 15:06:59 -07:00
Anthony Sottile
284fd45a08
py36+: miscellaneous (3, 6) cleanup
2020-10-02 15:04:16 -07:00
Anthony Sottile
a238d1f37d
py36+: remove TYPE_CHECKING from _pytest.compat
...
automated with:
```bash
git grep -l 'from .* import TYPE_CHECKING' |
xargs reorder-python-imports \
--application-directories .:src \
--remove-import 'from _pytest.compat import TYPE_CHECKING' \
--add-import 'from typing import TYPE_CHECKING'
```
2020-10-02 15:03:24 -07:00
Anthony Sottile
1f57fb079d
py36+: remove _pytest.compat.MODULE_NOT_FOUND_ERROR
2020-10-02 15:02:45 -07:00
Ran Benita
b250c9d615
Merge pull request #7813 from bluetech/findpaths-confusion
...
findpaths: fix regression causing incorrect rootdir to be determined
2020-09-30 13:21:18 +03:00
Ran Benita
61f80a783a
terminal: fix crash in header reporting when absolute testpaths is used
...
Regressed in 6.1.0 in 62e249a1f9
.
The `x` is an `str` but is expected to be a `pathlib.Path`. Not caught
by mypy because `config.getini()` returns `Any`.
Fix by just removing the `bestrelpath` call:
- testpaths are always relative to the rootdir, it thus would be very
unusual to specify an absolute path there.
- The code was wrong even before the regression: `py.path.local`'s
`bestrelpath` function expects a `py.path.local`, not an `str`. But it
had some weird `try ... except AttributeError` fallback which just
returns the argument, i.e. it was a no-op. So there is no behavior
change.
- It seems reasonable to me to just print the full path if that's what
the ini specifies.
2020-09-29 15:23:47 +03:00