From dd6939459826001fd75de76787372d112143ff12 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 11 Sep 2015 12:24:45 +0530 Subject: [PATCH] Added testcase and help for report option Fix added to show help of new reporting option 'a'. Also, added testcase for checking reporting functionality with option 'a'. Signed-off-by: Abhijeet Kasurde --- AUTHORS | 1 + _pytest/terminal.py | 2 +- testing/test_skipping.py | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index f8b46f94c..b0073c54f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,6 +3,7 @@ merlinux GmbH, Germany, office at merlinux eu Contributors include:: +Abhijeet Kasurde Anatoly Bubenkoff Andreas Zeidler Andy Freeland diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 9efa3841c..162f48e3e 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -19,7 +19,7 @@ def pytest_addoption(parser): group._addoption('-r', action="store", dest="reportchars", default=None, metavar="chars", help="show extra test summary info as specified by chars (f)ailed, " - "(E)error, (s)skipped, (x)failed, (X)passed (w)warnings.") + "(E)error, (s)skipped, (x)failed, (X)passed (w)warnings (a)all.") group._addoption('-l', '--showlocals', action="store_true", dest="showlocals", default=False, help="show locals in tracebacks (disabled by default).") diff --git a/testing/test_skipping.py b/testing/test_skipping.py index 6e827cb46..1048c9455 100644 --- a/testing/test_skipping.py +++ b/testing/test_skipping.py @@ -549,6 +549,43 @@ def test_reportchars_error(testdir): 'ERROR*test_foo*', ]) +def test_reportchars_all(testdir): + testdir.makepyfile(""" + import pytest + def test_1(): + assert 0 + @pytest.mark.xfail + def test_2(): + assert 0 + @pytest.mark.xfail + def test_3(): + pass + def test_4(): + pytest.skip("four") + """) + result = testdir.runpytest("-ra") + result.stdout.fnmatch_lines([ + "FAIL*test_1*", + "SKIP*four*", + "XFAIL*test_2*", + "XPASS*test_3*", + ]) + +def test_reportchars_all_error(testdir): + testdir.makepyfile( + conftest=""" + def pytest_runtest_teardown(): + assert 0 + """, + test_simple=""" + def test_foo(): + pass + """) + result = testdir.runpytest('-ra') + result.stdout.fnmatch_lines([ + 'ERROR*test_foo*', + ]) + @pytest.mark.xfail("hasattr(sys, 'pypy_version_info')") def test_errors_in_xfail_skip_expressions(testdir): testdir.makepyfile("""