Always show full comparison output if on CI.

When you don't get enough information with a test running on a CI, it's quite
frustrating, for various reasons:

- It's more likely to be a flaky test, so you might not be able to reproduce
  the failure.
- Passing -vv is quite bothersome (creating a temporary commit and reverting
  it)

For those reasons, if something goes wrong on CI, it's good to have as much
information as possible.
This commit is contained in:
Florian Bruhin
2016-01-08 10:58:26 +01:00
parent eebf5c1d2c
commit 3e5c9038ec
3 changed files with 24 additions and 3 deletions
+8 -1
View File
@@ -405,7 +405,7 @@ def test_sequence_comparison_uses_repr(testdir):
])
def test_assert_compare_truncate_longmessage(testdir):
def test_assert_compare_truncate_longmessage(monkeypatch, testdir):
testdir.makepyfile(r"""
def test_long():
a = list(range(200))
@@ -414,6 +414,7 @@ def test_assert_compare_truncate_longmessage(testdir):
b = '\n'.join(map(str, b))
assert a == b
""")
monkeypatch.delenv('CI', raising=False)
result = testdir.runpytest()
# without -vv, truncate the message showing a few diff lines only
@@ -431,6 +432,12 @@ def test_assert_compare_truncate_longmessage(testdir):
"*- 197",
])
monkeypatch.setenv('CI', '1')
result = testdir.runpytest()
result.stdout.fnmatch_lines([
"*- 197",
])
def test_assertrepr_loaded_per_dir(testdir):
testdir.makepyfile(test_base=['def test_base(): assert 1 == 2'])