diff --git a/_pytest/terminal.py b/_pytest/terminal.py index e226d607b..af89d0fc2 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -282,7 +282,7 @@ class TerminalReporter: line = "collected " else: line = "collecting " - line += str(self._numcollected) + " items" + line += str(self._numcollected) + " item" + ('' if self._numcollected == 1 else 's') if errors: line += " / %d errors" % errors if skipped: diff --git a/testing/test_runner.py b/testing/test_runner.py index 51d430fc8..def80ea5f 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -513,12 +513,12 @@ def test_pytest_no_tests_collected_exit_status(testdir): assert 1 """) result = testdir.runpytest() - result.stdout.fnmatch_lines('*collected 1 items*') + result.stdout.fnmatch_lines('*collected 1 item*') result.stdout.fnmatch_lines('*1 passed*') assert result.ret == main.EXIT_OK result = testdir.runpytest('-k nonmatch') - result.stdout.fnmatch_lines('*collected 1 items*') + result.stdout.fnmatch_lines('*collected 1 item*') result.stdout.fnmatch_lines('*1 deselected*') assert result.ret == main.EXIT_NOTESTSCOLLECTED diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 5a90b3dd4..45c354206 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -204,6 +204,15 @@ class TestTerminal(object): assert result.ret == 2 result.stdout.fnmatch_lines(['*KeyboardInterrupt*']) + def test_collect_single_item(self, testdir): + """Use singular 'item' when reporting a single test item""" + testdir.makepyfile(""" + def test_foobar(): + pass + """) + result = testdir.runpytest() + result.stdout.fnmatch_lines(['collected 1 item']) + class TestCollectonly(object): def test_collectonly_basic(self, testdir):