python-pytest-randomly/tests-restore-python2.7.patch

122 lines
2.9 KiB
Diff
Raw Normal View History

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