From 573860d71caef49f276fb000dcdd6856858d951b Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 31 Oct 2020 14:37:45 +0200 Subject: [PATCH 1/2] Merge pull request #7978 from nicoddemus/port-4.6-release-notes Manually add the remaining 4.6.x release notes to the changelog (cherry picked from commit dd323980f9b89335dd0b8e84a50838bee2500a93) --- doc/en/changelog.rst | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 8897ece8c..3f14921a8 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -1873,6 +1873,44 @@ Improved Documentation - `#5416 `_: Fix PytestUnknownMarkWarning in run/skip example. +pytest 4.6.11 (2020-06-04) +========================== + +Bug Fixes +--------- + +- `#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 `_: 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 `_: 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 `_ 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 `_: Remove usage of ``parser`` module, deprecated in Python 3.9. + + pytest 4.6.9 (2020-01-04) ========================= From 8cf0bbdf75f17fabfb51aa30741f5de8fc64f67a Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sat, 31 Oct 2020 14:46:50 +0200 Subject: [PATCH 2/2] Merge pull request #7982 from bluetech/symlink-collect pathlib: fix symlinked directories not followed during collection (cherry picked from commit a14a229d1bb9a7fe75799caa974b2cfb8f02f8b3) Changed pytester -> testdir. --- changelog/7981.bugfix.rst | 1 + src/_pytest/pathlib.py | 2 +- testing/test_collection.py | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelog/7981.bugfix.rst diff --git a/changelog/7981.bugfix.rst b/changelog/7981.bugfix.rst new file mode 100644 index 000000000..0a254b5d4 --- /dev/null +++ b/changelog/7981.bugfix.rst @@ -0,0 +1 @@ +Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0. diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index dda86d6be..6054a7c46 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -566,7 +566,7 @@ def visit( entries = sorted(os.scandir(path), key=lambda entry: entry.name) yield from 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) diff --git a/testing/test_collection.py b/testing/test_collection.py index 3e1b816b7..71908636b 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -1178,6 +1178,15 @@ def test_collect_symlink_out_of_tree(testdir): 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): """collect_ignore in parent conftest skips importing child (issue #4592).""" tests = testdir.mkpydir("tests")