mirrored from https://chromium.googlesource.com/infra/luci/recipes-py
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathlong_message.py
30 lines (25 loc) · 865 Bytes
/
long_message.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from recipe_engine import post_process
DEPS = [
'assertions',
'step',
]
def RunSteps(api):
api.assertions.longMessage = True
try:
api.assertions.assertEqual(0, 1, 'custom message')
except AssertionError as e:
api.step('AssertionError', [])
expected_message = '0 != 1 : custom message'
assert str(e) == expected_message, (
'Expected AssertionError with message: %r\nactual message: %r' %
(expected_message, str(e)))
def GenTests(api):
yield api.test(
'basic',
api.post_process(post_process.MustRun, 'AssertionError'),
api.post_process(post_process.StatusSuccess),
api.post_process(post_process.DropExpectation),
)