Skip to content

Commit b2e7b9d

Browse files
authored
Merge pull request #8010 from nicoddemus/pluralize
2 parents 5b2e5e8 + c7f8ad1 commit b2e7b9d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/_pytest/terminal.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ def _build_normal_summary_stats_line(
12041204
count = len(reports)
12051205
color = _color_for_type.get(key, _color_for_type_default)
12061206
markup = {color: True, "bold": color == main_color}
1207-
parts.append(("%d %s" % _make_plural(count, key), markup))
1207+
parts.append(("%d %s" % pluralize(count, key), markup))
12081208

12091209
if not parts:
12101210
parts = [("no tests ran", {_color_for_type_default: True})]
@@ -1223,9 +1223,7 @@ def _build_collect_only_summary_stats_line(
12231223

12241224
elif deselected == 0:
12251225
main_color = "green"
1226-
collected_output = "%d %s collected" % _make_plural(
1227-
self._numcollected, "test"
1228-
)
1226+
collected_output = "%d %s collected" % pluralize(self._numcollected, "test")
12291227
parts = [(collected_output, {main_color: True})]
12301228
else:
12311229
all_tests_were_deselected = self._numcollected == deselected
@@ -1241,7 +1239,7 @@ def _build_collect_only_summary_stats_line(
12411239

12421240
if errors:
12431241
main_color = _color_for_type["error"]
1244-
parts += [("%d %s" % _make_plural(errors, "error"), {main_color: True})]
1242+
parts += [("%d %s" % pluralize(errors, "error"), {main_color: True})]
12451243

12461244
return parts, main_color
12471245

@@ -1329,7 +1327,7 @@ def _folded_skips(
13291327
_color_for_type_default = "yellow"
13301328

13311329

1332-
def _make_plural(count: int, noun: str) -> Tuple[int, str]:
1330+
def pluralize(count: int, noun: str) -> Tuple[int, str]:
13331331
# No need to pluralize words such as `failed` or `passed`.
13341332
if noun not in ["error", "warnings", "test"]:
13351333
return count, noun

0 commit comments

Comments
 (0)