Skip to content

Commit

Permalink
Merge pull request #4 from wimglenn/refactored
Browse files Browse the repository at this point in the history
xfail -> XFAIL
  • Loading branch information
wimglenn committed Jan 30, 2019
2 parents 8dcf791 + 36a47e2 commit f6bbe14
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
pytest-custom-report 1.0.1 (2019-01-30)
=======================================

- xfail is renamed to XFAIL in pytest v4.2.0, adjust defaults


pytest-custom-report 1.0.0 (2018-08-21)
=======================================

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test outcome command-line argument name .ini file config key defaul
``passed`` ``--report-passed-verbose`` ``report_passed_verbose`` ``PASSED``
``xpassed`` ``--report-xpassed-verbose`` ``report_xpassed_verbose`` ``XPASS``
``failed`` ``--report-failed-verbose`` ``report_failed_verbose`` ``FAILED``
``xfailed`` ``--report-xfailed-verbose`` ``report_xfailed_verbose`` ``xfail``
``xfailed`` ``--report-xfailed-verbose`` ``report_xfailed_verbose`` ``XFAIL``
``skipped`` ``--report-skipped-verbose`` ``report_skipped_verbose`` ``SKIPPED``
``error`` ``--report-error-verbose`` ``report_error_verbose`` ``ERROR``
============== ============================ ========================== =======================
Expand Down
8 changes: 3 additions & 5 deletions pytest_custom_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
symbol to use when a test encounters an exception during setup or teardown (default {error})
"""
help = dict(zip(names, help.strip().format(**defaults).splitlines()))
defaults_verbose = "PASSED XPASS FAILED xfail SKIPPED ERROR".split()
defaults_verbose = "PASSED XPASS FAILED XFAIL SKIPPED ERROR".split()
msg_verbose = "as above, when '--verbose' is enabled (default {})"
help_verbose = [msg_verbose.format(v) for v in defaults_verbose]
defaults_verbose = dict(zip(names, defaults_verbose))
Expand All @@ -31,7 +31,7 @@ def pytest_addoption(parser):
def pytest_configure(config):
# this is called once after command line args have been parsed

def get(name, color=None):
def get(name):
# returns a 3-tuple of short and verbose strings, along with the test outcome string
# the command line arguments, if specified, take precedence over config file settings
if name not in names:
Expand All @@ -42,8 +42,6 @@ def get(name, color=None):
long = config.getoption("report_" + name + "_verbose", None)
if long is None:
long = config.getini("report_" + name + "_verbose")
if color is not None:
long = long, {color: True}
return name, short, long

symbols.update({
Expand All @@ -54,7 +52,7 @@ def get(name, color=None):
(False, "skipped", "call"): get("skipped"),
(False, "passed", "call"): get("passed"),
(False, "failed", "call"): get("failed"),
(True, "passed", "call"): get("xpassed", color="yellow"),
(True, "passed", "call"): get("xpassed"),
(True, "skipped", "setup"): get("xfailed"),
(True, "skipped", "call"): get("xfailed"),
(True, "skipped", "teardown"): get("xfailed"),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="pytest-custom-report",
version="1.0.0",
version="1.0.1",
url="https://github.com/wimglenn/pytest-custom-report",
description="Configure the symbols displayed for test outcomes",
long_description=open("README.rst").read(),
Expand Down
10 changes: 5 additions & 5 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ def test_default_symbols():
(False, 'passed', 'call'): ('passed', '.', 'PASSED'),
(False, 'skipped', 'call'): ('skipped', 's', 'SKIPPED'),
(False, 'skipped', 'setup'): ('skipped', 's', 'SKIPPED'),
(True, 'passed', 'call'): ('xpassed', 'X', ('XPASS', {'yellow': True})),
(True, 'skipped', 'call'): ('xfailed', 'x', 'xfail'),
(True, 'skipped', 'setup'): ('xfailed', 'x', 'xfail'),
(True, 'skipped', 'teardown'): ('xfailed', 'x', 'xfail'),
(True, 'passed', 'call'): ('xpassed', 'X', 'XPASS'),
(True, 'skipped', 'call'): ('xfailed', 'x', 'XFAIL'),
(True, 'skipped', 'setup'): ('xfailed', 'x', 'XFAIL'),
(True, 'skipped', 'teardown'): ('xfailed', 'x', 'XFAIL'),
}


Expand All @@ -179,7 +179,7 @@ def test_default_symbols():
symbol to use when a test fails, but it is marked as
an expected failure (default x)
--report-xfailed-verbose=REPORT_XFAILED_VERBOSE
as above, when '--verbose' is enabled (default xfail)
as above, when '--verbose' is enabled (default XFAIL)
--report-skipped=REPORT_SKIPPED
symbol to use when a test is skipped, e.g. by
@pytest.skip decorator (default s)
Expand Down

0 comments on commit f6bbe14

Please sign in to comment.