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

Method fail_test

test/BoostBuild.py:591–620  ·  view source on GitHub ↗
(self, condition, dump_difference=True, dump_stdio=True,
        dump_stack=True)

Source from the content-addressed store, hash-verified

589 return result
590
591 def fail_test(self, condition, dump_difference=True, dump_stdio=True,
592 dump_stack=True):
593 if not condition:
594 return
595
596 if dump_difference and hasattr(self, "difference"):
597 f = StringIO()
598 self.difference.pprint(f)
599 annotation("changes caused by the last build command",
600 f.getvalue())
601
602 if dump_stdio:
603 self.dump_stdio()
604
605 if "--preserve" in sys.argv:
606 print()
607 print("*** Copying the state of working dir into 'failed_test' ***")
608 print()
609 path = os.path.join(self.original_workdir, "failed_test")
610 if os.path.isdir(path):
611 shutil.rmtree(path, ignore_errors=False)
612 elif os.path.exists(path):
613 raise "Path " + path + " already exists and is not a directory"
614 shutil.copytree(self.workdir, path)
615 print("The failed command was:")
616 print(" ".join(self.last_program_invocation))
617
618 if dump_stack:
619 annotate_stack_trace()
620 sys.exit(1)
621
622 # A number of methods below check expectations with actual difference
623 # between directory trees before and after a build. All the 'expect*'

Callers 14

test_basicFunction · 0.95
copyMethod · 0.95
run_build_systemMethod · 0.95
__readMethod · 0.95
expect_additionMethod · 0.95
expect_removalMethod · 0.95
expect_modificationMethod · 0.95
expect_touchMethod · 0.95
expect_nothingMethod · 0.95
expect_nothing_moreMethod · 0.95
expect_contentMethod · 0.95
__expect_linesMethod · 0.95

Calls 4

dump_stdioMethod · 0.95
annotationFunction · 0.85
annotate_stack_traceFunction · 0.85
pprintMethod · 0.45

Tested by 3

test_basicFunction · 0.76
test_raw_emptyFunction · 0.76
test_raw_ntFunction · 0.76