MCPcopy Create free account
hub / github.com/boostorg/build / fail_test

Function fail_test

v2/test/TestCmd.py:103–130  ·  view source on GitHub ↗

Cause the test to fail. By default, the fail_test() method reports that the test FAILED and exits with a status of 1. If a condition argument is supplied, the test fails only if the condition is true.

(self=None, condition=True, function=None, skip=0)

Source from the content-addressed store, hash-verified

101
102
103def fail_test(self=None, condition=True, function=None, skip=0):
104 """Cause the test to fail.
105
106 By default, the fail_test() method reports that the test FAILED and exits
107 with a status of 1. If a condition argument is supplied, the test fails
108 only if the condition is true.
109
110 """
111 if not condition:
112 return
113 if not function is None:
114 function()
115 of = ""
116 desc = ""
117 sep = " "
118 if not self is None:
119 if self.program:
120 of = " of " + join(self.program, " ")
121 sep = "\n\t"
122 if self.description:
123 desc = " [" + self.description + "]"
124 sep = "\n\t"
125
126 at = caller(traceback.extract_stack(), skip)
127
128 sys.stderr.write("FAILED test" + of + desc + sep + at + """
129in directory: """ + os.getcwd() )
130 sys.exit(1)
131
132
133def no_result(self=None, condition=True, function=None, skip=0):

Callers 1

fail_testMethod · 0.85

Calls 2

callerFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected