diff --git a/pytest-5.3.5.tar.gz b/pytest-5.3.5.tar.gz deleted file mode 100644 index ae6ffd7..0000000 --- a/pytest-5.3.5.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0d5fe9189a148acc3c3eb2ac8e1ac0742cb7618c084f3d228baaec0c254b318d -size 990935 diff --git a/pytest-5.4.2.tar.gz b/pytest-5.4.2.tar.gz new file mode 100644 index 0000000..08fe09f --- /dev/null +++ b/pytest-5.4.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb2b5e935f6a019317e455b6da83dd8650ac9ffd2ee73a7b657a30873d67a698 +size 1020640 diff --git a/python-pytest.changes b/python-pytest.changes index 2f840bb..3c1a4d1 100644 --- a/python-pytest.changes +++ b/python-pytest.changes @@ -1,3 +1,36 @@ +------------------------------------------------------------------- +Tue May 12 08:49:45 UTC 2020 - Ondřej Súkup + +- Update to 5.4.2 + * Fix crash with captured output when using the capsysbinary fixture. + * Ensure a unittest.IsolatedAsyncioTestCase is actually awaited. + * Fix TerminalRepr instances to be hashable again. + * Fix regression where functions registered with TestCase.addCleanup + were not being called on test failures. + * Allow users to still set the deprecated TerminalReporter.writer attribute. + * Revert “tmpdir: clean up indirection via config for factories + * Fixed regression: asyncbase.TestCase tests are executed correctly again + * Fix File.from_constructor so it forwards extra keyword arguments to the constructor. + * Classes with broken __getattribute__ methods are displayed correctly during failures. + * Fix _is_setup_py for files encoded differently than locale. + +------------------------------------------------------------------- +Mon Apr 27 10:43:32 UTC 2020 - Tomáš Chvátal + +- Update to 5.4.1: + * #6909: Revert the change introduced by #6330, which required all + arguments to @pytest.mark.parametrize to be explicitly defined + in the function signature. + * #6910: Fix crash when plugins return an unknown stats while using + the --reportlog option. + * #6316: Matching of -k EXPRESSION to test names is now case-insensitive. + * #6443: Plugins specified with -p are now loaded after internal plugins + * #6637: Removed the long-deprecated pytest_itemstart hook. + * #6673: Reversed / fix meaning of “+/-” in error diffs. “-” means that + sth. expected is missing in the result and “+” means that there are + unexpected extras in the result. +- Remove merged patch tidy-up-embeddedfile.patch + ------------------------------------------------------------------- Wed Mar 18 07:45:23 UTC 2020 - Steve Kowalik diff --git a/python-pytest.spec b/python-pytest.spec index 7a931f8..d404a76 100644 --- a/python-pytest.spec +++ b/python-pytest.spec @@ -27,19 +27,16 @@ %endif %define skip_python2 1 Name: python-pytest%{psuffix} -Version: 5.3.5 +Version: 5.4.2 Release: 0 Summary: Python testing tool with autodiscovery and detailed asserts License: MIT URL: https://github.com/pytest-dev/pytest Source: https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz -# UPSTREAM FIX: gh/pytest-dev#6899 -Patch0: tidy-up-embeddedfile.patch BuildRequires: %{python_module setuptools >= 40.0} BuildRequires: %{python_module setuptools_scm} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-atomicwrites >= 1.0 Requires: python-attrs >= 17.4.0 Requires: python-importlib-metadata >= 0.12 Requires: python-more-itertools >= 4.0.0 @@ -47,7 +44,6 @@ Requires: python-packaging Requires: python-pluggy >= 0.12 Requires: python-py >= 1.5.0 Requires: python-setuptools -Requires: python-six >= 1.10.0 Requires: python-wcwidth Requires(post): update-alternatives Requires(postun): update-alternatives @@ -57,7 +53,7 @@ BuildArch: noarch BuildRequires: %{python_module Jinja2} BuildRequires: %{python_module Twisted} BuildRequires: %{python_module decorator} -BuildRequires: %{python_module hypothesis} +BuildRequires: %{python_module hypothesis >= 3.56} BuildRequires: %{python_module importlib-metadata >= 0.12} BuildRequires: %{python_module mock} BuildRequires: %{python_module nose} @@ -68,7 +64,6 @@ BuildRequires: %{python_module pytest >= %{version}} BuildRequires: %{python_module pytest-forked} BuildRequires: %{python_module pytest-xdist} BuildRequires: %{python_module requests} -BuildRequires: %{python_module setuptools_scm} BuildRequires: %{python_module xmlschema} BuildRequires: lsof %endif @@ -92,7 +87,6 @@ pytest is a cross-project Python testing tool. It provides: %prep %setup -q -n pytest-%{version} -%autopatch -p1 %build %python_build diff --git a/tidy-up-embeddedfile.patch b/tidy-up-embeddedfile.patch deleted file mode 100644 index e602ee4..0000000 --- a/tidy-up-embeddedfile.patch +++ /dev/null @@ -1,243 +0,0 @@ -From 29e4cb5d45f44379aba948c2cd791b3b97210e31 Mon Sep 17 00:00:00 2001 -From: Ran Benita -Date: Sat, 7 Mar 2020 18:38:22 +0200 -Subject: [PATCH] Remove safe_text_dupfile() and simplify EncodedFile - -I tried to understand what the `safe_text_dupfile()` function and -`EncodedFile` class do. Outside tests, `EncodedFile` is only used by -`safe_text_dupfile`, and `safe_text_dupfile` is only used by -`FDCaptureBinary.__init__()`. I then started to eliminate always-true -conditions based on the single call site, and in the end nothing was -left except of a couple workarounds that are still needed. ---- - src/_pytest/capture.py | 66 ++++++++++-------------------------- - testing/test_capture.py | 75 ++++++----------------------------------- - 2 files changed, 28 insertions(+), 113 deletions(-) - -Index: pytest-5.3.5/src/_pytest/capture.py -=================================================================== ---- pytest-5.3.5.orig/src/_pytest/capture.py -+++ pytest-5.3.5/src/_pytest/capture.py -@@ -391,57 +391,21 @@ class CaptureFixture: - yield - - --def safe_text_dupfile(f, mode, default_encoding="UTF8"): -- """ return an open text file object that's a duplicate of f on the -- FD-level if possible. -- """ -- encoding = getattr(f, "encoding", None) -- try: -- fd = f.fileno() -- except Exception: -- if "b" not in getattr(f, "mode", "") and hasattr(f, "encoding"): -- # we seem to have a text stream, let's just use it -- return f -- else: -- newfd = os.dup(fd) -- if "b" not in mode: -- mode += "b" -- f = os.fdopen(newfd, mode, 0) # no buffering -- return EncodedFile(f, encoding or default_encoding) -- -- --class EncodedFile: -- errors = "strict" # possibly needed by py3 code (issue555) -- -- def __init__(self, buffer, encoding): -- self.buffer = buffer -- self.encoding = encoding -- -- def write(self, obj): -- if isinstance(obj, str): -- obj = obj.encode(self.encoding, "replace") -- else: -- raise TypeError( -- "write() argument must be str, not {}".format(type(obj).__name__) -- ) -- self.buffer.write(obj) -- -- def writelines(self, linelist): -- data = "".join(linelist) -- self.write(data) -+class EncodedFile(io.TextIOWrapper): -+ __slots__ = () - - @property - def name(self): -- """Ensure that file.name is a string.""" -+ # Ensure that file.name is a string. Workaround for a Python bug -+ # fixed in >=3.7.4: https://bugs.python.org/issue36015 - return repr(self.buffer) - - @property - def mode(self): -+ # TextIOWrapper doesn't expose a mode, but at least some of our -+ # tests check it. - return self.buffer.mode.replace("b", "") - -- def __getattr__(self, name): -- return getattr(object.__getattribute__(self, "buffer"), name) -- - - CaptureResult = collections.namedtuple("CaptureResult", ["out", "err"]) - -@@ -555,9 +519,12 @@ class FDCaptureBinary: - self.syscapture = SysCapture(targetfd) - else: - if tmpfile is None: -- f = TemporaryFile() -- with f: -- tmpfile = safe_text_dupfile(f, mode="wb+") -+ tmpfile = EncodedFile( -+ TemporaryFile(buffering=0), -+ encoding="utf-8", -+ errors="replace", -+ write_through=True, -+ ) - if targetfd in patchsysdict: - self.syscapture = SysCapture(targetfd, tmpfile) - else: -@@ -582,7 +549,7 @@ class FDCaptureBinary: - - def snap(self): - self.tmpfile.seek(0) -- res = self.tmpfile.read() -+ res = self.tmpfile.buffer.read() - self.tmpfile.seek(0) - self.tmpfile.truncate() - return res -@@ -624,10 +591,10 @@ class FDCapture(FDCaptureBinary): - EMPTY_BUFFER = str() # type: ignore - - def snap(self): -- res = super().snap() -- enc = getattr(self.tmpfile, "encoding", None) -- if enc and isinstance(res, bytes): -- res = str(res, enc, "replace") -+ self.tmpfile.seek(0) -+ res = self.tmpfile.read() -+ self.tmpfile.seek(0) -+ self.tmpfile.truncate() - return res - - -Index: pytest-5.3.5/testing/test_capture.py -=================================================================== ---- pytest-5.3.5.orig/testing/test_capture.py -+++ pytest-5.3.5/testing/test_capture.py -@@ -1,14 +1,11 @@ - import contextlib - import io - import os --import pickle - import subprocess - import sys - import textwrap --from io import StringIO - from io import UnsupportedOperation --from typing import List --from typing import TextIO -+from typing import BinaryIO - - import pytest - from _pytest import capture -@@ -838,49 +835,6 @@ def tmpfile(testdir): - f.close() - - --@needsosdup --def test_dupfile(tmpfile) -> None: -- flist = [] # type: List[TextIO] -- for i in range(5): -- nf = capture.safe_text_dupfile(tmpfile, "wb") -- assert nf != tmpfile -- assert nf.fileno() != tmpfile.fileno() -- assert nf not in flist -- print(i, end="", file=nf) -- flist.append(nf) -- -- fname_open = flist[0].name -- assert fname_open == repr(flist[0].buffer) -- -- for i in range(5): -- f = flist[i] -- f.close() -- fname_closed = flist[0].name -- assert fname_closed == repr(flist[0].buffer) -- assert fname_closed != fname_open -- tmpfile.seek(0) -- s = tmpfile.read() -- assert "01234" in repr(s) -- tmpfile.close() -- assert fname_closed == repr(flist[0].buffer) -- -- --def test_dupfile_on_bytesio(): -- bio = io.BytesIO() -- f = capture.safe_text_dupfile(bio, "wb") -- f.write("hello") -- assert bio.getvalue() == b"hello" -- assert "BytesIO object" in f.name -- -- --def test_dupfile_on_textio(): -- sio = StringIO() -- f = capture.safe_text_dupfile(sio, "wb") -- f.write("hello") -- assert sio.getvalue() == "hello" -- assert not hasattr(f, "name") -- -- - @contextlib.contextmanager - def lsof_check(): - pid = os.getpid() -@@ -1299,8 +1253,8 @@ def test_error_attribute_issue555(testdi - """ - import sys - def test_capattr(): -- assert sys.stdout.errors == "strict" -- assert sys.stderr.errors == "strict" -+ assert sys.stdout.errors == "replace" -+ assert sys.stderr.errors == "replace" - """ - ) - reprec = testdir.inline_run() -@@ -1375,15 +1329,6 @@ def test_crash_on_closing_tmpfile_py27(t - result.stdout.no_fnmatch_line("*IOError*") - - --def test_pickling_and_unpickling_encoded_file(): -- # See https://bitbucket.org/pytest-dev/pytest/pull-request/194 -- # pickle.loads() raises infinite recursion if -- # EncodedFile.__getattr__ is not implemented properly -- ef = capture.EncodedFile(None, None) -- ef_as_str = pickle.dumps(ef) -- pickle.loads(ef_as_str) -- -- - def test_global_capture_with_live_logging(testdir): - # Issue 3819 - # capture should work with live cli logging -@@ -1489,6 +1434,19 @@ def test_typeerror_encodedfile_write(tes - result_with_capture = testdir.runpytest(str(p)) - - assert result_with_capture.ret == result_without_capture.ret -- result_with_capture.stdout.fnmatch_lines( -- ["E * TypeError: write() argument must be str, not bytes"] -+ out = result_with_capture.stdout.str() -+ assert ("TypeError: write() argument must be str, not bytes" in out) or ( -+ "TypeError: unicode argument expected, got 'bytes'" in out - ) -+ -+def test_encodedfile_writelines(tmpfile: BinaryIO) -> None: -+ ef = capture.EncodedFile(tmpfile, encoding="utf-8") -+ with pytest.raises(TypeError): -+ ef.writelines([b"line1", b"line2"]) -+ assert ef.writelines(["line3", "line4"]) is None # type: ignore[func-returns-value] # noqa: F821 -+ ef.flush() -+ tmpfile.seek(0) -+ assert tmpfile.read() == b"line3line4" -+ tmpfile.close() -+ with pytest.raises(ValueError): -+ ef.read()