Accepting request 829131 from home:mcalabkova:branches:devel:languages:python:pytest

- Update to 3.4.1
  * Fix numpy error ``ValueError: Seed must be between 0 and 2**32 - 1`` when
    passed a seed outside of this range.
- Add upstream patch pytest6.patch to fix tests

OBS-URL: https://build.opensuse.org/request/show/829131
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-randomly?expand=0&rev=20
This commit is contained in:
Tomáš Chvátal 2020-08-25 10:09:19 +00:00 committed by Git OBS Bridge
parent dd97f570aa
commit 40b3284969
5 changed files with 88 additions and 6 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f6144bfc482874a27c9d1827f4a49b9fc16c0bf4277b8159f44ee549705e7625
size 32265

3
3.4.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6760ded053c4b7457a2d49e10cb63b3ff45624a2d7fed4a832c86efe2ac5f3aa
size 32468

71
pytest6.patch Normal file
View File

@ -0,0 +1,71 @@
From c89ba6bb4458704f47e08d3f2fcc7cf0ebb8f9da Mon Sep 17 00:00:00 2001
From: Adam Johnson <me@adamj.eu>
Date: Mon, 27 Jul 2020 12:06:57 +0100
Subject: [PATCH] Fix deprecation warnings in tests (#281)
---
tests/test_pytest_randomly.py | 20 +++++++++++++-------
tox.ini | 2 +-
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/tests/test_pytest_randomly.py b/tests/test_pytest_randomly.py
index 817d6ad..07cb646 100644
--- a/tests/test_pytest_randomly.py
+++ b/tests/test_pytest_randomly.py
@@ -121,7 +121,7 @@ def test_a():
out.stderr.fnmatch_lines(
[
(
- "pytest: error: argument --randomly-seed: 'invalidvalue' "
+ "*: error: argument --randomly-seed: 'invalidvalue' "
+ "is not an integer or the string 'last'"
)
]
@@ -439,8 +439,8 @@ def collect(self):
class NoOpItem(pytest.Item):
- def __init__(self, path, parent, module=None):
- super(NoOpItem, self).__init__(path, parent)
+ def __init__(self, name, parent, module=None):
+ super(NoOpItem, self).__init__(name=name, parent=parent)
if module is not None:
self.module = module
@@ -451,13 +451,19 @@ def runtest(self):
def pytest_collect_file(path, parent):
if not str(path).endswith('.py'):
return
- return MyCollector(
+ return MyCollector.from_parent(
+ parent=parent,
fspath=str(path),
items=[
- NoOpItem(str(path), parent, 'foo'),
- NoOpItem(str(path), parent),
+ NoOpItem.from_parent(
+ name=str(path) + "1",
+ parent=parent, module="foo"
+ ),
+ NoOpItem.from_parent(
+ name=str(path) + "2",
+ parent=parent,
+ ),
],
- parent=parent,
)
"""
)
diff --git a/tox.ini b/tox.ini
index 1dcee71..91722a8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,7 +13,7 @@ python =
3.9: py39
[testenv]
-commands = pytest -p no:randomly {posargs}
+commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m pytest -p no:randomly {posargs}
[testenv:py35]
deps = -rrequirements/py35.txt

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Aug 25 08:27:52 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- Update to 3.4.1
* Fix numpy error ``ValueError: Seed must be between 0 and 2**32 - 1`` when
passed a seed outside of this range.
- Add upstream patch pytest6.patch to fix tests
-------------------------------------------------------------------
Tue Jun 9 07:47:42 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -19,12 +19,14 @@
%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pytest-randomly
Version: 3.4.0
Version: 3.4.1
Release: 0
Summary: Pytest plugin to randomly order tests and control random.seed
License: BSD-3-Clause
URL: https://github.com/pytest-dev/pytest-randomly
Source: https://github.com/pytest-dev/pytest-randomly/archive/%{version}.tar.gz
#PATCH-FIX-UPSTREAM https://github.com/pytest-dev/pytest-randomly/commit/c89ba6bb4458704f47e08d3f2fcc7cf0ebb8f9da Fix deprecation warnings in tests (#281)
Patch0: pytest6.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@ -65,6 +67,7 @@ Features:
%prep
%setup -q -n pytest-randomly-%{version}
%patch0 -p1
# Disregard Python 3.4+ restriction
sed -i '/python_requires/d' setup.py
@ -77,10 +80,10 @@ sed -i '/python_requires/d' setup.py
%check
# test_entrypoint_injection needs installed module for pytest to use
%pytest -k 'not test_entrypoint_injection and not test_passing_nonsense_for_randomly_seed'
%pytest -k 'not test_entrypoint_injection'
%files %{python_files}
%doc AUTHORS.rst README.rst
%doc README.rst
%license LICENSE
%{python_sitelib}/*