Skip to content

Commit fa99080

Browse files
committed
Drop 3.5 add 3.9
1 parent 0ae244c commit fa99080

16 files changed

+39
-40
lines changed

.travis.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ matrix:
55
include:
66
- python: pypy3
77
env: TOXENV=pypy3
8+
- python: 3.9
9+
env:
10+
- TOXENV=py39
11+
- BLACKEN=true
812
- python: 3.8
913
env:
1014
- TOXENV=py38
11-
- BLACKEN=true
1215
- python: 3.7
1316
env: TOXENV=py37
1417
- python: 3.6
1518
env: TOXENV=py36
16-
- python: 3.5
17-
env: TOXENV=py35
1819
install:
1920
- if [ ${BLACKEN} ]; then travis_retry pip install black; fi
2021
- travis_retry pip install coveralls tox

diff_cover/diff_cover_tool.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ def parse_coverage_args(argv):
143143
help=DIFF_RANGE_NOTATION_HELP,
144144
)
145145

146-
parser.add_argument(
147-
"--version", action="version", version="diff-cover {}".format(VERSION)
148-
)
146+
parser.add_argument("--version", action="version", version=f"diff-cover {VERSION}")
149147

150148
parser.add_argument(
151149
"--ignore-whitespace",
@@ -247,7 +245,7 @@ def main(argv=None, directory=None):
247245
if percent_covered >= fail_under:
248246
return 0
249247
else:
250-
LOGGER.error("Failure. Coverage is below {}%.".format(fail_under))
248+
LOGGER.error(f"Failure. Coverage is below {fail_under}%.")
251249
return 1
252250

253251

diff_cover/diff_quality_tool.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def parse_quality_args(argv):
153153
parser.add_argument(
154154
"--version",
155155
action="version",
156-
version="diff-quality {}".format(diff_cover.VERSION),
156+
version=f"diff-quality {diff_cover.VERSION}",
157157
)
158158
parser.add_argument(
159159
"--ignore-whitespace",
@@ -256,7 +256,7 @@ def main(argv=None, directory=None):
256256
try:
257257
input_reports.append(open(path, "rb"))
258258
except OSError:
259-
LOGGER.warning("Could not load '{}'".format(path))
259+
LOGGER.warning(f"Could not load '{path}'")
260260
reporter = QualityReporter(driver, input_reports, user_options)
261261

262262
percent_passing = generate_quality_report(
@@ -273,22 +273,22 @@ def main(argv=None, directory=None):
273273
if percent_passing >= fail_under:
274274
return 0
275275
else:
276-
LOGGER.error("Failure. Quality is below {}%.".format(fail_under))
276+
LOGGER.error(f"Failure. Quality is below {fail_under}%.")
277277
return 1
278278

279279
except ImportError:
280-
LOGGER.error("Quality tool not installed: '{}'".format(tool))
280+
LOGGER.error(f"Quality tool not installed: '{tool}'")
281281
return 1
282282
except OSError as exc:
283-
LOGGER.error("Failure: '{}'".format(exc))
283+
LOGGER.error(f"Failure: '{exc}'")
284284
return 1
285285
# Close any reports we opened
286286
finally:
287287
for file_handle in input_reports:
288288
file_handle.close()
289289

290290
else:
291-
LOGGER.error("Quality tool not recognized: '{}'".format(tool))
291+
LOGGER.error(f"Quality tool not recognized: '{tool}'")
292292
return 1
293293

294294

diff_cover/diff_reporter.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def __init__(
116116
options.append("unstaged")
117117

118118
# Branch is always present, so use as basis for name
119-
name = "{}...HEAD".format(compare_branch)
119+
name = f"{compare_branch}...HEAD"
120120
if len(options) > 0:
121121
# If more options are present separate them by comma's, except the last one
122122
for item in options[:-1]:
@@ -319,7 +319,7 @@ def _parse_source_sections(self, diff_str):
319319
# We tolerate other information before we have
320320
# a source file defined, unless it's a hunk line
321321
if line.startswith("@@"):
322-
msg = "Hunk has no source file: '{}'".format(line)
322+
msg = f"Hunk has no source file: '{line}'"
323323
raise GitDiffError(msg)
324324

325325
return source_dict
@@ -404,7 +404,7 @@ def _parse_source_line(self, line):
404404
elif "--cc" in line:
405405
regex = self.MERGE_CONFLICT_RE
406406
else:
407-
msg = "Do not recognize format of source in line '{}'".format(line)
407+
msg = f"Do not recognize format of source in line '{line}'"
408408
raise GitDiffError(msg)
409409

410410
# Parse for the source file path
@@ -414,7 +414,7 @@ def _parse_source_line(self, line):
414414
return groups[0]
415415

416416
else:
417-
msg = "Could not parse source path in line '{}'".format(line)
417+
msg = f"Could not parse source path in line '{line}'"
418418
raise GitDiffError(msg)
419419

420420
def _parse_hunk_line(self, line):
@@ -455,11 +455,11 @@ def _parse_hunk_line(self, line):
455455
raise GitDiffError(msg)
456456

457457
else:
458-
msg = "Could not find start of hunk in line '{}'".format(line)
458+
msg = f"Could not find start of hunk in line '{line}'"
459459
raise GitDiffError(msg)
460460

461461
else:
462-
msg = "Could not parse hunk in line '{}'".format(line)
462+
msg = f"Could not parse hunk in line '{line}'"
463463
raise GitDiffError(msg)
464464

465465
@staticmethod

diff_cover/tests/helpers.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,16 @@ def _deleted_file_entries(deleted_files):
122122

123123
for src_file in deleted_files:
124124
# File information
125-
output.append("diff --git a/{} b/{}".format(src_file, src_file))
125+
output.append(f"diff --git a/{src_file} b/{src_file}")
126126
output.append("index 629e8ad..91b8c0a 100644")
127-
output.append("--- a/{}".format(src_file))
127+
output.append(f"--- a/{src_file}")
128128
output.append("+++ b/dev/null")
129129

130130
# Choose a random number of lines
131131
num_lines = random.randint(1, 30)
132132

133133
# Hunk information
134-
output.append("@@ -0,{} +0,0 @@".format(num_lines))
134+
output.append(f"@@ -0,{num_lines} +0,0 @@")
135135
output.extend(["-" + _random_string() for _ in range(num_lines)])
136136

137137
return output
@@ -150,14 +150,14 @@ def _source_file_entry(src_file, modified_lines):
150150
output = []
151151

152152
# Line for the file names
153-
output.append("diff --git a/{} b/{}".format(src_file, src_file))
153+
output.append(f"diff --git a/{src_file} b/{src_file}")
154154

155155
# Index line
156156
output.append("index 629e8ad..91b8c0a 100644")
157157

158158
# Additions/deletions
159-
output.append("--- a/{}".format(src_file))
160-
output.append("+++ b/{}".format(src_file))
159+
output.append(f"--- a/{src_file}")
160+
output.append(f"+++ b/{src_file}")
161161

162162
# Hunk information
163163
for (start, end) in _hunks(modified_lines):

diff_cover/tests/test_diff_quality_main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_parse_invalid_arg(self):
6262

6363
for argv in invalid_argv:
6464
with self.assertRaises(SystemExit):
65-
print("args = {}".format(argv))
65+
print(f"args = {argv}")
6666
parse_quality_args(argv)
6767

6868
def test_parse_with_exclude(self):

diff_cover/tests/test_diff_reporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def test_git_diff_error(self):
408408
self.diff.src_paths_changed()
409409

410410
with self.assertRaises(GitDiffError):
411-
print("lines_changed() should fail for {}".format(diff_str))
411+
print(f"lines_changed() should fail for {diff_str}")
412412
self.diff.lines_changed("subdir/file1.py")
413413

414414
def test_plus_sign_in_hunk_bug(self):

diff_cover/tests/test_git_diff.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def check_diff_committed(self, diff_range_notation, ignore_whitespace):
4242
if ignore_whitespace:
4343
expected.append("--ignore-all-space")
4444
expected.append("--ignore-blank-lines")
45-
expected.append("origin/master{}HEAD".format(diff_range_notation))
45+
expected.append(f"origin/master{diff_range_notation}HEAD")
4646
self.subprocess.Popen.assert_called_with(
4747
expected, stdout=self.subprocess.PIPE, stderr=self.subprocess.PIPE
4848
)

diff_cover/tests/test_integration.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ def setUp(self):
4242
cwd = os.getcwd()
4343

4444
self._mock_popen = patch("subprocess.Popen").start()
45-
self._mock_sys = patch("{}.sys".format(self.tool_module)).start()
45+
self._mock_sys = patch(f"{self.tool_module}.sys").start()
4646
try:
47-
self._mock_getcwd = patch("{}.os.getcwdu".format(self.tool_module)).start()
47+
self._mock_getcwd = patch(f"{self.tool_module}.os.getcwdu").start()
4848
except AttributeError:
49-
self._mock_getcwd = patch("{}.os.getcwd".format(self.tool_module)).start()
49+
self._mock_getcwd = patch(f"{self.tool_module}.os.getcwd").start()
5050
self._git_root_path = cwd
5151
self._mock_getcwd.return_value = self._git_root_path
5252

@@ -559,7 +559,7 @@ def _call_quality_expecting_error(
559559
"""
560560
with open("git_diff_add.txt", encoding="utf-8") as git_diff_file:
561561
self._set_git_diff_output(git_diff_file.read(), "")
562-
argv = ["diff-quality", "--violations={}".format(tool_name), report_arg]
562+
argv = ["diff-quality", f"--violations={tool_name}", report_arg]
563563

564564
with patch("diff_cover.diff_quality_tool.LOGGER") as logger:
565565
exit_value = diff_quality_main(argv)

diff_cover/tests/test_snippets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,5 +301,5 @@ def _src_lines(self, start_line, end_line):
301301
(Line 1, Line 2, ...).
302302
"""
303303
return "\n".join(
304-
["Line {}".format(line_num) for line_num in range(start_line, end_line + 1)]
304+
[f"Line {line_num}" for line_num in range(start_line, end_line + 1)]
305305
)

diff_cover/violationsreporters/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def violations(self, src_path):
148148
if self.driver_tool_installed is None:
149149
self.driver_tool_installed = self.driver.installed()
150150
if not self.driver_tool_installed:
151-
raise OSError("{} is not installed".format(self.driver.name))
151+
raise OSError(f"{self.driver.name} is not installed")
152152
command = copy.deepcopy(self.driver.command)
153153
if self.options:
154154
command.append(self.options)

diff_cover/violationsreporters/java_violations_reporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def parse_reports(self, reports):
120120
start = int(line.get("start"))
121121
end = int(line.get("end"))
122122
for line_number in range(start, end + 1):
123-
error_str = "{}: {}".format(category, short_message)
123+
error_str = f"{category}: {short_message}"
124124
violation = Violation(line_number, error_str)
125125
filename = GitPathTool.relative_path(line.get("sourcepath"))
126126
violations_dict[filename].append(violation)

diff_cover/violationsreporters/violations_reporter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def parse_reports(self, reports):
465465
pylint_code, function_name, message
466466
)
467467
else:
468-
error_str = "{}: {}".format(pylint_code, message)
468+
error_str = f"{pylint_code}: {message}"
469469

470470
violation = Violation(int(line_number), error_str)
471471
violations_dict[pylint_src_path].append(violation)

requirements/requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Production requirements
2-
inflect==3.0.2 # remove when you drop support for python3.5
32
pygments
43
Jinja2>=2.7.1
54
jinja2_pluralize

setup.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
test_suite="nose.collector",
1717
description=DESCRIPTION,
1818
license="Apache 2.0",
19-
python_requires=">= 3.5",
19+
python_requires=">= 3.6",
2020
classifiers=[
2121
"Development Status :: 5 - Production/Stable",
2222
"Environment :: Console",
@@ -25,9 +25,10 @@
2525
"Operating System :: OS Independent",
2626
"Programming Language :: Python",
2727
"Programming Language :: Python :: 3",
28-
"Programming Language :: Python :: 3.5",
2928
"Programming Language :: Python :: 3.6",
3029
"Programming Language :: Python :: 3.7",
30+
"Programming Language :: Python :: 3.8",
31+
"Programming Language :: Python :: 3.9",
3132
"Programming Language :: Python :: Implementation :: CPython",
3233
"Programming Language :: Python :: Implementation :: PyPy",
3334
"Topic :: Software Development :: Testing",

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py35, py36, py37, py38, pypy3
2+
envlist = py36, py37, py38, py39, pypy3
33

44
[testenv]
55
whitelist_externals =

0 commit comments

Comments
 (0)