summaryrefslogtreecommitdiff
path: root/testing/test_terminal.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2020-01-29 01:00:41 +0100
committerGitHub <noreply@github.com>2020-01-29 01:00:41 +0100
commit3ccf2a5e615bc238857d93292ac8d693491a15d7 (patch)
treeecf7770bd2b9c1c46a42fc864bb2231981a5c2b7 /testing/test_terminal.py
parente440b432582f10922a6ee6cd3e8a9e97fe8e44a8 (diff)
parentddaa5d88aca31ba87383840aff394695088bc9c3 (diff)
downloadpytest-3ccf2a5e615bc238857d93292ac8d693491a15d7.tar.gz
Merge pull request #6524 from blueyed/reportchars-default
terminal: default to `fE` with `-r` (reportchars)
Diffstat (limited to 'testing/test_terminal.py')
-rw-r--r--testing/test_terminal.py51
1 files changed, 38 insertions, 13 deletions
diff --git a/testing/test_terminal.py b/testing/test_terminal.py
index 8c14acc80..b3b127cd1 100644
--- a/testing/test_terminal.py
+++ b/testing/test_terminal.py
@@ -814,9 +814,9 @@ class TestTerminalFunctional:
def test_fail_extra_reporting(testdir, monkeypatch):
monkeypatch.setenv("COLUMNS", "80")
testdir.makepyfile("def test_this(): assert 0, 'this_failed' * 100")
- result = testdir.runpytest()
+ result = testdir.runpytest("-rN")
result.stdout.no_fnmatch_line("*short test summary*")
- result = testdir.runpytest("-rf")
+ result = testdir.runpytest()
result.stdout.fnmatch_lines(
[
"*test summary*",
@@ -985,37 +985,62 @@ def test_color_yes_collection_on_non_atty(testdir, verbose):
def test_getreportopt():
+ from _pytest.terminal import _REPORTCHARS_DEFAULT
+
class Config:
class Option:
- reportchars = ""
- disable_warnings = True
+ reportchars = _REPORTCHARS_DEFAULT
+ disable_warnings = False
option = Option()
config = Config()
+ assert _REPORTCHARS_DEFAULT == "fE"
+
+ # Default.
+ assert getreportopt(config) == "wfE"
+
config.option.reportchars = "sf"
- assert getreportopt(config) == "sf"
+ assert getreportopt(config) == "wsf"
config.option.reportchars = "sfxw"
- assert getreportopt(config) == "sfx"
+ assert getreportopt(config) == "sfxw"
+
+ config.option.reportchars = "a"
+ assert getreportopt(config) == "wsxXEf"
+
+ config.option.reportchars = "N"
+ assert getreportopt(config) == "w"
+
+ config.option.reportchars = "NwfE"
+ assert getreportopt(config) == "wfE"
+
+ config.option.reportchars = "NfENx"
+ assert getreportopt(config) == "wx"
# Now with --disable-warnings.
- config.option.disable_warnings = False
+ config.option.disable_warnings = True
config.option.reportchars = "a"
- assert getreportopt(config) == "sxXwEf" # NOTE: "w" included!
+ assert getreportopt(config) == "sxXEf"
config.option.reportchars = "sfx"
- assert getreportopt(config) == "sfxw"
+ assert getreportopt(config) == "sfx"
config.option.reportchars = "sfxw"
- assert getreportopt(config) == "sfxw"
+ assert getreportopt(config) == "sfx"
config.option.reportchars = "a"
- assert getreportopt(config) == "sxXwEf" # NOTE: "w" included!
+ assert getreportopt(config) == "sxXEf"
config.option.reportchars = "A"
- assert getreportopt(config) == "PpsxXwEf"
+ assert getreportopt(config) == "PpsxXEf"
+
+ config.option.reportchars = "AN"
+ assert getreportopt(config) == ""
+
+ config.option.reportchars = "NwfE"
+ assert getreportopt(config) == "fE"
def test_terminalreporter_reportopt_addopts(testdir):
@@ -1132,7 +1157,7 @@ class TestGenericReporting:
)
for tbopt in ["long", "short", "no"]:
print("testing --tb=%s..." % tbopt)
- result = testdir.runpytest("--tb=%s" % tbopt)
+ result = testdir.runpytest("-rN", "--tb=%s" % tbopt)
s = result.stdout.str()
if tbopt == "long":
assert "print(6*7)" in s