Update to 4.3.0 and fix FTBFS (#1671167, #1687384)

This commit is contained in:
Miro Hrončok 2019-03-12 17:55:57 +01:00
parent a738a33ad4
commit ed8c0c8802
5 changed files with 160 additions and 10 deletions

63
4804.patch Normal file
View File

@ -0,0 +1,63 @@
From 5505826db921b0e46c30004ea20b6bf6e478e683 Mon Sep 17 00:00:00 2001
From: Anthony Sottile <asottile@umich.edu>
Date: Fri, 15 Feb 2019 17:34:31 -0800
Subject: [PATCH] Fix python3.8 / pypy failures
---
testing/code/test_source.py | 11 ++++++++---
testing/test_skipping.py | 5 ++++-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/testing/code/test_source.py b/testing/code/test_source.py
index 0103acb702..fc5eaed041 100644
--- a/testing/code/test_source.py
+++ b/testing/code/test_source.py
@@ -560,7 +560,6 @@ def test_oneline_and_comment():
assert str(source) == "raise ValueError"
-@pytest.mark.xfail(hasattr(sys, "pypy_version_info"), reason="does not work on pypy")
def test_comments():
source = '''def test():
"comment 1"
@@ -576,9 +575,15 @@ def test_comments():
'''
for line in range(2, 6):
assert str(getstatement(line, source)) == " x = 1"
- for line in range(6, 10):
+ if sys.version_info >= (3, 8) or hasattr(sys, "pypy_version_info"):
+ tqs_start = 8
+ else:
+ tqs_start = 10
+ assert str(getstatement(10, source)) == '"""'
+ for line in range(6, tqs_start):
assert str(getstatement(line, source)) == " assert False"
- assert str(getstatement(10, source)) == '"""'
+ for line in range(tqs_start, 10):
+ assert str(getstatement(line, source)) == '"""\ncomment 4\n"""'
def test_comment_in_statement():
diff --git a/testing/test_skipping.py b/testing/test_skipping.py
index b2a515f11c..33878c8f47 100644
--- a/testing/test_skipping.py
+++ b/testing/test_skipping.py
@@ -910,7 +910,6 @@ def test_foo():
result.stdout.fnmatch_lines(["ERROR*test_foo*"])
-@pytest.mark.xfail("hasattr(sys, 'pypy_version_info')")
def test_errors_in_xfail_skip_expressions(testdir):
testdir.makepyfile(
"""
@@ -931,6 +930,10 @@ def test_func():
if sys.platform.startswith("java"):
# XXX report this to java
markline = "*" + markline[8:]
+ elif hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (6,):
+ markline = markline[5:]
+ elif sys.version_info >= (3, 8) or hasattr(sys, "pypy_version_info"):
+ markline = markline[4:]
result.stdout.fnmatch_lines(
[
"*ERROR*test_nameerror*",

42
4914.patch Normal file
View File

@ -0,0 +1,42 @@
From d32ab6029feb178df664e0d347e234cc4480eb7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Tue, 12 Mar 2019 16:28:10 +0100
Subject: [PATCH] Fix pytest tests invocation with custom PYTHONPATH
Fixes https://github.com/pytest-dev/pytest/issues/4913
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
---
changelog/4913.trivial.rst | 1 +
testing/test_collection.py | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 changelog/4913.trivial.rst
diff --git a/changelog/4913.trivial.rst b/changelog/4913.trivial.rst
new file mode 100644
index 000000000..7846775cc
--- /dev/null
+++ b/changelog/4913.trivial.rst
@@ -0,0 +1 @@
+Fix pytest tests invocation with custom ``PYTHONPATH``.
diff --git a/testing/test_collection.py b/testing/test_collection.py
index 97c46d8c2..37f7ad89c 100644
--- a/testing/test_collection.py
+++ b/testing/test_collection.py
@@ -2,6 +2,7 @@
from __future__ import division
from __future__ import print_function
+import os
import pprint
import sys
import textwrap
@@ -1108,7 +1109,7 @@ def test_collect_pyargs_with_testpaths(testdir, monkeypatch):
"""
)
)
- monkeypatch.setenv("PYTHONPATH", str(testdir.tmpdir))
+ monkeypatch.setenv("PYTHONPATH", str(testdir.tmpdir), prepend=os.pathsep)
with root.as_cwd():
result = testdir.runpytest_subprocess()
result.stdout.fnmatch_lines(["*1 passed in*"])

32
4922.patch Normal file
View File

@ -0,0 +1,32 @@
From 134b957bf42ef92f892ace04651c87ab6d09999f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Thu, 14 Mar 2019 12:15:05 +0100
Subject: [PATCH] Remove deprecated Sphinx directive add_description_unit()
Partial solution for https://github.com/pytest-dev/pytest/issues/4912
---
changelog/4912.trivial.rst | 1 +
doc/en/conf.py | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
create mode 100644 changelog/4912.trivial.rst
diff --git a/changelog/4912.trivial.rst b/changelog/4912.trivial.rst
new file mode 100644
index 000000000..9c5ca6d8e
--- /dev/null
+++ b/changelog/4912.trivial.rst
@@ -0,0 +1 @@
+Remove deprecated Sphinx directive, ``add_description_unit()``.
diff --git a/doc/en/conf.py b/doc/en/conf.py
index 74a43596e..5daa15a06 100644
--- a/doc/en/conf.py
+++ b/doc/en/conf.py
@@ -335,7 +335,7 @@
def setup(app):
# from sphinx.ext.autodoc import cut_lines
# app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
- app.add_description_unit(
+ app.add_object_type(
"confval",
"confval",
objname="configuration value",

View File

@ -2,12 +2,21 @@
%global pylib_version 1.5.0
Name: pytest
Version: 3.9.3
Release: 3%{?dist}
Version: 4.3.0
Release: 1%{?dist}
Summary: Simple powerful testing with Python
License: MIT
URL: http://pytest.org
Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
URL: https://pytest.org
Source0: %{pypi_source}
# Python 3.8 compatibility in tests
Patch1: https://github.com/pytest-dev/pytest/pull/4804.patch
# Don't override our PYTHONPATH in tests
Patch2: https://github.com/pytest-dev/pytest/pull/4914.patch
# Update one call to Sphinx 2.0
Patch3: https://github.com/pytest-dev/pytest/pull/4922.patch
# The test in this specfile use pytest-timeout
# When building pytest for the first time with new Python version
@ -25,9 +34,11 @@ Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}
%bcond_without docs
%if %{with docs}
BuildRequires: %{_bindir}/sphinx-build-3
BuildRequires: python3-sphinxcontrib-trio
BuildRequires: %{_bindir}/rst2html
BuildRequires: python3-pygments-pytest
BuildRequires: python3-sphinx
BuildRequires: python3-sphinx-removed-in
BuildRequires: python3-sphinxcontrib-trio
%endif
BuildArch: noarch
@ -42,6 +53,7 @@ BuildRequires: python2-attrs
BuildRequires: python2-devel
BuildRequires: python2-funcsigs
BuildRequires: python2-hypothesis
BuildRequires: python2-mock
BuildRequires: python2-more-itertools >= 4.0.0
BuildRequires: python2-pathlib2 >= 2.2.0
BuildRequires: python2-pluggy >= 0.7
@ -57,7 +69,6 @@ BuildRequires: python2-pytest-timeout
%if %{with optional_tests}
BuildRequires: python2-decorator
BuildRequires: python2-jinja2
BuildRequires: python2-mock
BuildRequires: python2-nose
BuildRequires: python2-twisted
%endif
@ -91,7 +102,6 @@ BuildRequires: python3-pytest-timeout
BuildRequires: python3-argcomplete
BuildRequires: python3-decorator
BuildRequires: python3-jinja2
BuildRequires: python3-mock
BuildRequires: python3-nose
BuildRequires: python3-twisted
%endif
@ -103,7 +113,7 @@ Obsoletes: platform-python-%{name} < %{version}-%{release}
py.test provides simple, yet powerful testing for Python.
%prep
%autosetup
%autosetup -p1
%build
%py2_build
@ -199,6 +209,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{python3_sitelib}/__pycache__/pytest.*
%changelog
* Tue Mar 12 2019 Miro Hrončok <mhroncok@redhat.com> - 4.3.0-1
- Update to 4.3.0 and fix FTBFS (#1671167, #1687384)
* Mon Feb 18 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.9.3-3
- Enable python dependency generator

View File

@ -1 +1 @@
SHA512 (pytest-3.9.3.tar.gz) = 03ab708ebff936dc296d8c42c549789db42916ac8d4a1df817aebdcdfcb1d0c45126e6238f958eb1523938db6529baa282a9f2ff5742295b2113873abe07ef83
SHA512 (pytest-4.3.0.tar.gz) = 67894dc6c7001290e3372b5015227cf800c02d40ff28f76fad1249bd866f25c2368d8f0895d7c97a6b3318608f88e44db0bff723e7aeef79e380227cd7ec147e