Accepting request 689139 from devel:languages:python:pytest

OBS-URL: https://build.opensuse.org/request/show/689139
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-randomly?expand=0&rev=3
This commit is contained in:
Dominique Leuenberger 2019-03-28 21:48:43 +00:00 committed by Git OBS Bridge
commit 2ba4cc4def
5 changed files with 151 additions and 6 deletions

View File

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

View File

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

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Mar 26 10:08:08 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Downgrade Faker dependency to Recommends
- Add Suggests for numpy
- Add tests-restore-python2.7.patch to re-add support for Python 2.7
- Use PYTHONDONTWRITEBYTECODE=true to fix file-contains-buildroot
on Leap 42.3
- Update to v2.1.1
* Fix including tests in sdist after re-arrangement in 2.1.0
- from v2.1.0
* Add the option --randomly-seed=last to reuse the last used value
for the seed
- from v2.0.0
* Drop Python 2 support, only Python 3.4+ is supported now
-------------------------------------------------------------------
Thu Feb 14 15:24:04 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
@ -6,4 +22,4 @@ Thu Feb 14 15:24:04 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
-------------------------------------------------------------------
Mon Jan 21 03:52:33 UTC 2019 - Todd R <toddrme2178@gmail.com>
- Initial version
- Initial version for v1.2.3

View File

@ -18,24 +18,28 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pytest-randomly
Version: 1.2.3
Version: 2.1.1
Release: 0
Summary: Pytest plugin to randomly order tests and control random.seed
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/adamchainz/pytest-randomly
Source: https://files.pythonhosted.org/packages/source/p/pytest-randomly/pytest-randomly-%{version}.tar.gz
# Reverse of https://github.com/pytest-dev/pytest-randomly/commit/7ca48ad.patch
Patch0: tests-restore-python2.7.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Faker
Requires: python-pytest
Recommends: python-Faker
Suggests: python-numpy
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Faker}
BuildRequires: %{python_module factory_boy}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module six}
# /SECTION
%python_subpackages
@ -61,6 +65,9 @@ Features:
%prep
%setup -q -n pytest-randomly-%{version}
%patch0 -p1
# Disregard Python 3.4+ restriction
sed -i '/python_requires/d' setup.py
%build
%python_build
@ -70,6 +77,7 @@ Features:
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
export PYTHONDONTWRITEBYTECODE=true
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_bin_suffix} -v
%files %{python_files}

View File

@ -0,0 +1,121 @@
--- a/test_pytest_randomly.py
+++ b/test_pytest_randomly.py
@@ -1,6 +1,13 @@
+# -*- encoding:utf-8 -*-
+from __future__ import absolute_import, division, print_function, unicode_literals
+
import pytest
+import six
-pytest_plugins = ['pytester']
+if six.PY3:
+ pytest_plugins = ['pytester']
+else:
+ pytest_plugins = [b'pytester']
@pytest.fixture
@@ -221,7 +228,11 @@
test_c=code,
test_d=code,
)
- args = ['-v', '--randomly-seed=15']
+ args = ['-v']
+ if six.PY3: # Python 3 random changes
+ args.append('--randomly-seed=15')
+ else:
+ args.append('--randomly-seed=41')
out = ourtestdir.runpytest(*args)
@@ -245,7 +256,11 @@
test_c=code,
test_d=code,
)
- args = ['-v', '--randomly-seed=15']
+ args = ['-v']
+ if six.PY3: # Python 3 random changes
+ args.append('--randomly-seed=15')
+ else:
+ args.append('--randomly-seed=41')
args.append('--randomly-dont-reset-seed')
out = ourtestdir.runpytest(*args)
@@ -285,7 +300,11 @@
pass
"""
)
- args = ['-v', '--randomly-seed=15']
+ args = ['-v']
+ if six.PY3: # Python 3 random changes
+ args.append('--randomly-seed=15')
+ else:
+ args.append('--randomly-seed=41')
out = ourtestdir.runpytest(*args)
@@ -317,7 +336,11 @@
pass
"""
)
- args = ['-v', '--randomly-seed=15']
+ args = ['-v']
+ if six.PY3: # Python 3 random changes
+ args.append('--randomly-seed=15')
+ else:
+ args.append('--randomly-seed=41')
out = ourtestdir.runpytest(*args)
@@ -346,7 +369,11 @@
pass
"""
)
- args = ['-v', '--randomly-seed=15']
+ args = ['-v']
+ if six.PY3: # Python 3 random changes
+ args.append('--randomly-seed=15')
+ else:
+ args.append('--randomly-seed=41')
out = ourtestdir.runpytest(*args)
@@ -380,7 +407,11 @@
pass
"""
)
- args = ['-v', '--randomly-seed=15']
+ args = ['-v']
+ if six.PY3: # Python 3 random changes
+ args.append('--randomly-seed=15')
+ else:
+ args.append('--randomly-seed=41')
out = ourtestdir.runpytest(*args)
@@ -411,7 +442,11 @@
return 9002
"""
)
- args = ['-v', '--doctest-modules', '--randomly-seed=5']
+ args = ['-v', '--doctest-modules']
+ if six.PY3: # Python 3 random changes
+ args.append('--randomly-seed=5')
+ else:
+ args.append('--randomly-seed=2')
out = ourtestdir.runpytest(*args)
out.assert_outcomes(passed=2)
@@ -474,7 +509,11 @@
>>> 2 - 2
0
''')
- args = ['-v', '--randomly-seed=1']
+ args = ['-v']
+ if six.PY3: # Python 3 random changes
+ args.append('--randomly-seed=1')
+ else:
+ args.append('--randomly-seed=4')
out = ourtestdir.runpytest(*args)
out.assert_outcomes(passed=2)