python-pytest-randomly/tests-restore-python2.7.patch
Matej Cepl af3225e5d7 Accepting request 688847 from home:jayvdb:branches:devel:languages:python:pytest
- 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
- Make sure we execute tests
- Initial version for v1.2.3

OBS-URL: https://build.opensuse.org/request/show/688847
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-randomly?expand=0&rev=5
2019-03-26 20:19:27 +00:00

122 lines
2.9 KiB
Diff

--- 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)