Merge pull request #7983 from bluetech/backports

[6.1.x] Two backports
This commit is contained in:
Ran Benita 2020-11-08 16:38:11 +02:00 committed by GitHub
commit 296f468a7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1 @@
Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0.

View File

@ -1873,6 +1873,44 @@ Improved Documentation
- `#5416 <https://github.com/pytest-dev/pytest/issues/5416>`_: Fix PytestUnknownMarkWarning in run/skip example. - `#5416 <https://github.com/pytest-dev/pytest/issues/5416>`_: Fix PytestUnknownMarkWarning in run/skip example.
pytest 4.6.11 (2020-06-04)
==========================
Bug Fixes
---------
- `#6334 <https://github.com/pytest-dev/pytest/issues/6334>`_: Fix summary entries appearing twice when ``f/F`` and ``s/S`` report chars were used at the same time in the ``-r`` command-line option (for example ``-rFf``).
The upper case variants were never documented and the preferred form should be the lower case.
- `#7310 <https://github.com/pytest-dev/pytest/issues/7310>`_: Fix ``UnboundLocalError: local variable 'letter' referenced before
assignment`` in ``_pytest.terminal.pytest_report_teststatus()``
when plugins return report objects in an unconventional state.
This was making ``pytest_report_teststatus()`` skip
entering if-block branches that declare the ``letter`` variable.
The fix was to set the initial value of the ``letter`` before
the if-block cascade so that it always has a value.
pytest 4.6.10 (2020-05-08)
==========================
Features
--------
- `#6870 <https://github.com/pytest-dev/pytest/issues/6870>`_: New ``Config.invocation_args`` attribute containing the unchanged arguments passed to ``pytest.main()``.
Remark: while this is technically a new feature and according to our `policy <https://docs.pytest.org/en/latest/py27-py34-deprecation.html#what-goes-into-4-6-x-releases>`_ it should not have been backported, we have opened an exception in this particular case because it fixes a serious interaction with ``pytest-xdist``, so it can also be considered a bugfix.
Trivial/Internal Changes
------------------------
- `#6404 <https://github.com/pytest-dev/pytest/issues/6404>`_: Remove usage of ``parser`` module, deprecated in Python 3.9.
pytest 4.6.9 (2020-01-04) pytest 4.6.9 (2020-01-04)
========================= =========================

View File

@ -566,7 +566,7 @@ def visit(
entries = sorted(os.scandir(path), key=lambda entry: entry.name) entries = sorted(os.scandir(path), key=lambda entry: entry.name)
yield from entries yield from entries
for entry in entries: for entry in entries:
if entry.is_dir(follow_symlinks=False) and recurse(entry): if entry.is_dir() and recurse(entry):
yield from visit(entry.path, recurse) yield from visit(entry.path, recurse)

View File

@ -1178,6 +1178,15 @@ def test_collect_symlink_out_of_tree(testdir):
assert result.ret == 0 assert result.ret == 0
def test_collect_symlink_dir(testdir: Testdir) -> None:
"""A symlinked directory is collected."""
dir = testdir.mkdir("dir")
dir.join("test_it.py").write("def test_it(): pass")
symlink_or_skip(dir, testdir.tmpdir.join("symlink_dir"))
result = testdir.runpytest()
result.assert_outcomes(passed=2)
def test_collectignore_via_conftest(testdir): def test_collectignore_via_conftest(testdir):
"""collect_ignore in parent conftest skips importing child (issue #4592).""" """collect_ignore in parent conftest skips importing child (issue #4592)."""
tests = testdir.mkpydir("tests") tests = testdir.mkpydir("tests")