Skip to content

Commit b5e7038

Browse files
authored
Merge pull request #137 from hugovk/rm-eol
Drop support for EOL Python 2.7 and 3.5
2 parents f4d349b + fa5fe26 commit b5e7038

9 files changed

Lines changed: 52 additions & 80 deletions

File tree

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
python-version: [
15-
"3.5",
1615
"3.6",
1716
"3.7",
1817
"3.8",

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repos:
44
rev: 19.10b0
55
hooks:
66
- id: black
7-
args: [--safe, --quiet]
7+
args: [--safe, --quiet, --target-version, py36]
88
- repo: https://github.com/pre-commit/pre-commit-hooks
99
rev: v3.1.0
1010
hooks:
@@ -30,7 +30,7 @@ repos:
3030
rev: v2.7.1
3131
hooks:
3232
- id: pyupgrade
33-
args: [--py3-plus]
33+
args: [--py36-plus]
3434
- repo: local
3535
hooks:
3636
- id: rst

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
language: python
33
python:
4-
- 3.5
54
- 3.6
65
- 3.7
76
- 3.8
@@ -20,8 +19,7 @@ install:
2019
- pip install -q pre-commit
2120
- pre-commit install
2221
script:
23-
- if [[ "$TRAVIS_PYTHON_VERSION" > "3.5" ]] &&
24-
[[ "$TRAVIS_PYTHON_VERSION" != pypy* ]]; then
22+
- if [[ "$TRAVIS_PYTHON_VERSION" != pypy* ]]; then
2523
pre-commit run --all-files --show-diff-on-failure;
2624
fi
2725
- pytest

CHANGES.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
Changelog
22
=========
33

4-
9.2 (unreleased)
5-
----------------
4+
10.0 (unreleased)
5+
-----------------
6+
7+
Backwards incompatible changes
8+
++++++++++++++++++++++++++++++
69

7-
- Nothing changed yet.
10+
- Drop support for Python 3.5.
811

912

1013
9.1.1 (2020-09-29)

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Requirements
1919

2020
You will need the following prerequisites in order to use pytest-rerunfailures:
2121

22-
- Python 3.5, up to 3.8, or PyPy3
22+
- Python 3.6, up to 3.8, or PyPy3
2323
- pytest 5.0 or newer
2424

2525
This package is currently tested against the last 5 minor pytest releases. In

pytest_rerunfailures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def show_rerun(terminalreporter, lines):
303303
if rerun:
304304
for rep in rerun:
305305
pos = rep.nodeid
306-
lines.append("RERUN {}".format(pos))
306+
lines.append(f"RERUN {pos}")
307307

308308

309309
if not PYTEST_GTE_61:

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
py_modules=["pytest_rerunfailures"],
1515
entry_points={"pytest11": ["rerunfailures = pytest_rerunfailures"]},
1616
install_requires=["setuptools>=40.0", "pytest >= 5.0"],
17-
python_requires=">=3.5",
17+
python_requires=">=3.6",
1818
license="Mozilla Public License 2.0 (MPL 2.0)",
1919
keywords="py.test pytest rerun failures flaky",
2020
zip_safe=False,
@@ -29,10 +29,11 @@
2929
"Topic :: Software Development :: Quality Assurance",
3030
"Topic :: Software Development :: Testing",
3131
"Topic :: Utilities",
32-
"Programming Language :: Python :: 3.5",
32+
"Programming Language :: Python :: 3",
3333
"Programming Language :: Python :: 3.6",
3434
"Programming Language :: Python :: 3.7",
3535
"Programming Language :: Python :: 3.8",
36+
"Programming Language :: Python :: 3 :: Only",
3637
"Programming Language :: Python :: Implementation :: CPython",
3738
"Programming Language :: Python :: Implementation :: PyPy",
3839
],

test_pytest_rerunfailures.py

Lines changed: 37 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,20 @@
1414

1515

1616
def temporary_failure(count=1):
17-
return """
17+
return f"""
1818
import py
1919
path = py.path.local(__file__).dirpath().ensure('test.res')
2020
count = path.read() or 1
21-
if int(count) <= {0}:
21+
if int(count) <= {count}:
2222
path.write(int(count) + 1)
23-
raise Exception('Failure: {{0}}'.format(count))""".format(
24-
count
25-
)
23+
raise Exception('Failure: {{0}}'.format(count))"""
2624

2725

2826
def check_outcome_field(outcomes, field_name, expected_value):
2927
field_value = outcomes.get(field_name, 0)
30-
assert (
31-
field_value == expected_value
32-
), "outcomes.{} has unexpected value. Expected '{}' but got '{}'".format(
33-
field_name, expected_value, field_value
28+
assert field_value == expected_value, (
29+
f"outcomes.{field_name} has unexpected value. "
30+
f"Expected '{expected_value}' but got '{field_value}'"
3431
)
3532

3633

@@ -61,14 +58,12 @@ def test_no_rerun_on_pass(testdir):
6158
def test_no_rerun_on_skipif_mark(testdir):
6259
reason = str(random.random())
6360
testdir.makepyfile(
64-
"""
61+
f"""
6562
import pytest
66-
@pytest.mark.skipif(reason='{}')
63+
@pytest.mark.skipif(reason='{reason}')
6764
def test_skip():
6865
pass
69-
""".format(
70-
reason
71-
)
66+
"""
7267
)
7368
result = testdir.runpytest("--reruns", "1")
7469
assert_outcomes(result, passed=0, skipped=1)
@@ -77,13 +72,11 @@ def test_skip():
7772
def test_no_rerun_on_skip_call(testdir):
7873
reason = str(random.random())
7974
testdir.makepyfile(
80-
"""
75+
f"""
8176
import pytest
8277
def test_skip():
83-
pytest.skip('{}')
84-
""".format(
85-
reason
86-
)
78+
pytest.skip('{reason}')
79+
"""
8780
)
8881
result = testdir.runpytest("--reruns", "1")
8982
assert_outcomes(result, passed=0, skipped=1)
@@ -105,13 +98,11 @@ def test_xfail():
10598
def test_no_rerun_on_xfail_call(testdir):
10699
reason = str(random.random())
107100
testdir.makepyfile(
108-
"""
101+
f"""
109102
import pytest
110103
def test_xfail():
111-
pytest.xfail('{}')
112-
""".format(
113-
reason
114-
)
104+
pytest.xfail('{reason}')
105+
"""
115106
)
116107
result = testdir.runpytest("--reruns", "1")
117108
assert_outcomes(result, passed=0, xfailed=1)
@@ -144,11 +135,9 @@ def pytest_runtest_setup(item):
144135
def test_rerun_passes_after_temporary_setup_failure(testdir):
145136
testdir.makepyfile("def test_pass(): pass")
146137
testdir.makeconftest(
147-
"""
138+
f"""
148139
def pytest_runtest_setup(item):
149-
{}""".format(
150-
temporary_failure()
151-
)
140+
{temporary_failure()}"""
152141
)
153142
result = testdir.runpytest("--reruns", "1", "-r", "R")
154143
assert_outcomes(result, passed=1, rerun=1)
@@ -162,65 +151,55 @@ def test_rerun_fails_after_consistent_test_failure(testdir):
162151

163152
def test_rerun_passes_after_temporary_test_failure(testdir):
164153
testdir.makepyfile(
165-
"""
154+
f"""
166155
def test_pass():
167-
{}""".format(
168-
temporary_failure()
169-
)
156+
{temporary_failure()}"""
170157
)
171158
result = testdir.runpytest("--reruns", "1", "-r", "R")
172159
assert_outcomes(result, passed=1, rerun=1)
173160

174161

175162
def test_rerun_passes_after_temporary_test_failure_with_flaky_mark(testdir):
176163
testdir.makepyfile(
177-
"""
164+
f"""
178165
import pytest
179166
@pytest.mark.flaky(reruns=2)
180167
def test_pass():
181-
{}""".format(
182-
temporary_failure(2)
183-
)
168+
{temporary_failure(2)}"""
184169
)
185170
result = testdir.runpytest("-r", "R")
186171
assert_outcomes(result, passed=1, rerun=2)
187172

188173

189174
def test_reruns_if_flaky_mark_is_called_without_options(testdir):
190175
testdir.makepyfile(
191-
"""
176+
f"""
192177
import pytest
193178
@pytest.mark.flaky()
194179
def test_pass():
195-
{}""".format(
196-
temporary_failure(1)
197-
)
180+
{temporary_failure(1)}"""
198181
)
199182
result = testdir.runpytest("-r", "R")
200183
assert_outcomes(result, passed=1, rerun=1)
201184

202185

203186
def test_reruns_if_flaky_mark_is_called_with_positional_argument(testdir):
204187
testdir.makepyfile(
205-
"""
188+
f"""
206189
import pytest
207190
@pytest.mark.flaky(2)
208191
def test_pass():
209-
{}""".format(
210-
temporary_failure(2)
211-
)
192+
{temporary_failure(2)}"""
212193
)
213194
result = testdir.runpytest("-r", "R")
214195
assert_outcomes(result, passed=1, rerun=2)
215196

216197

217198
def test_no_extra_test_summary_for_reruns_by_default(testdir):
218199
testdir.makepyfile(
219-
"""
200+
f"""
220201
def test_pass():
221-
{}""".format(
222-
temporary_failure()
223-
)
202+
{temporary_failure()}"""
224203
)
225204
result = testdir.runpytest("--reruns", "1")
226205
assert "RERUN" not in result.stdout.str()
@@ -229,11 +208,9 @@ def test_pass():
229208

230209
def test_extra_test_summary_for_reruns(testdir):
231210
testdir.makepyfile(
232-
"""
211+
f"""
233212
def test_pass():
234-
{}""".format(
235-
temporary_failure()
236-
)
213+
{temporary_failure()}"""
237214
)
238215
result = testdir.runpytest("--reruns", "1", "-r", "R")
239216
result.stdout.fnmatch_lines_random(["RERUN test_*:*"])
@@ -242,11 +219,9 @@ def test_pass():
242219

243220
def test_verbose(testdir):
244221
testdir.makepyfile(
245-
"""
222+
f"""
246223
def test_pass():
247-
{}""".format(
248-
temporary_failure()
249-
)
224+
{temporary_failure()}"""
250225
)
251226
result = testdir.runpytest("--reruns", "1", "-v")
252227
result.stdout.fnmatch_lines_random(["test_*:* RERUN*"])
@@ -323,14 +298,12 @@ def test_fail():
323298
@pytest.mark.parametrize("delay_time", [-1, 0, 0.0, 1, 2.5])
324299
def test_reruns_with_delay_marker(testdir, delay_time):
325300
testdir.makepyfile(
326-
"""
301+
f"""
327302
import pytest
328303
329-
@pytest.mark.flaky(reruns=2, reruns_delay={})
304+
@pytest.mark.flaky(reruns=2, reruns_delay={delay_time})
330305
def test_fail_two():
331-
assert False""".format(
332-
delay_time
333-
)
306+
assert False"""
334307
)
335308

336309
time.sleep = mock.MagicMock()
@@ -498,12 +471,10 @@ def test_pytest_runtest_logfinish_is_called(testdir):
498471
hook_message = "Message from pytest_runtest_logfinish hook"
499472
testdir.makepyfile("def test_pass(): pass")
500473
testdir.makeconftest(
501-
r"""
474+
fr"""
502475
def pytest_runtest_logfinish(nodeid, location):
503-
print("\n{}\n")
504-
""".format(
505-
hook_message
506-
)
476+
print("\n{hook_message}\n")
477+
"""
507478
)
508479
result = testdir.runpytest("--reruns", "1", "-s")
509480
result.stdout.fnmatch_lines(hook_message)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ max-line-length = 88
1111
[tox]
1212
envlist =
1313
linting
14-
py{35,36,37,38,py3}-pytest{50,51,52,53,54,60,61}
14+
py{36,37,38,py3}-pytest{50,51,52,53,54,60,61}
1515
minversion = 3.17.1
1616

1717
[testenv]

0 commit comments

Comments
 (0)