Skip to content

Commit f94b694

Browse files
committed
Fix deprecation warnings and require pytest >= 3.6
I think it is OK to require new pytest versions instead of having to support older versions. Fix #29
1 parent 76bc695 commit f94b694

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ python:
88
- pypy3
99
- nightly
1010
env:
11-
- TOXENV=pytest29
12-
- TOXENV=pytest30
11+
- TOXENV=pytest36
12+
- TOXENV=pytest37
13+
- TOXENV=pytest38
1314
matrix:
1415
include:
1516
- python: 2.7
@@ -30,4 +31,4 @@ deploy:
3031
tags: true
3132
repo: pytest-dev/pytest-repeat
3233
python: 3.5
33-
condition: "$TOXENV = pytest30"
34+
condition: "$TOXENV = pytest38"

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Release Notes
22
-------------
33

4+
**Unreleased**
5+
6+
* Fix mark deprecation warnings in new pytest versions.
7+
8+
* ``pytest-repeat`` now requires pytest>=3.6.
9+
410
**0.7.0 (2018-08-23)**
511

612
* Move step number to the end of the parametrisation ID

pytest_repeat.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ def __pytest_repeat_step_number(request):
5252
@pytest.hookimpl(trylast=True)
5353
def pytest_generate_tests(metafunc):
5454
count = metafunc.config.option.count
55-
if hasattr(metafunc.function, 'repeat'):
56-
count = int(metafunc.function.repeat.args[0])
55+
m = metafunc.definition.get_closest_marker('repeat')
56+
if m is not None:
57+
count = int(m.args[0])
5758
if count > 1:
5859

5960
def make_progress_id(i, n=count):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
py_modules=['pytest_repeat'],
1111
entry_points={'pytest11': ['repeat = pytest_repeat']},
1212
setup_requires=['setuptools_scm'],
13-
install_requires=['pytest>=2.8.7'],
13+
install_requires=['pytest>=3.6'],
1414
license='Mozilla Public License 2.0 (MPL 2.0)',
1515
keywords='py.test pytest repeat',
1616
classifiers=[

test_repeat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_repeat():
106106
pass
107107
""")
108108
result = testdir.runpytest('--count', 'a')
109-
assert result.ret == 2
109+
assert result.ret == 4
110110

111111
def test_unittest_test(self, testdir):
112112
testdir.makepyfile("""
@@ -256,4 +256,4 @@ def test_repeat():
256256
pass
257257
""")
258258
result = testdir.runpytest('--count', '2', '--repeat-scope', 'a')
259-
assert result.ret == 2
259+
assert result.ret == 4

tox.ini

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py{27,34,35,36,py,py3}-pytest{29,30}, flake8
7+
envlist = py{27,34,35,36,py,py3}-pytest{36,37,38}, flake8
88

99
[testenv]
10-
commands = py.test {posargs}
10+
commands = pytest {posargs}
1111
deps =
12-
pytest29: pytest==2.9.2
13-
pytest30: pytest==3.0.1
12+
pytest36: pytest~=3.6
13+
pytest37: pytest~=3.7
14+
pytest38: pytest~=3.8
1415

1516
[testenv:flake8]
1617
basepython = python
1718
deps = flake8
18-
commands = flake8 {posargs:.}
19+
commands = flake8 {posargs:pytest_repeat.py test_repeat.py}

0 commit comments

Comments
 (0)