262
262
self.stream.flush()
263
263
# seems best to treat this as success from point-of-view of unittest
264
264
# -- it actually does nothing so it barely matters :)
265
unittest.TestResult.addSuccess(self, test)
267
except KeyboardInterrupt:
270
self.addError(test, test.__exc_info())
272
unittest.TestResult.addSuccess(self, test)
267
274
def printErrorList(self, flavour, errors):
268
275
for test, err in errors:
553
560
Read contents into memory, close, and delete.
562
if self._log_file is None:
555
564
bzrlib.trace.disable_test_log(self._log_nonce)
556
565
self._log_file.seek(0)
557
566
self._log_contents = self._log_file.read()
742
751
def run_bzr_error(self, error_regexes, *args, **kwargs):
743
752
"""Run bzr, and check that stderr contains the supplied regexes
745
This defaults to retcode=3, so you must supply retcode=? if you expect
754
:param error_regexes: Sequence of regular expressions which
755
must each be found in the error output. The relative ordering
757
:param args: command-line arguments for bzr
758
:param kwargs: Keyword arguments which are interpreted by run_bzr
759
This function changes the default value of retcode to be 3,
760
since in most cases this is run when you expect bzr to fail.
747
761
:return: (out, err) The actual output of running the command (in case you
748
762
want to do more inspection)
765
# Make sure that commit is failing because there is nothing to do
766
self.run_bzr_error(['no changes to commit'],
767
'commit', '-m', 'my commit comment')
768
# Make sure --strict is handling an unknown file, rather than
769
# giving us the 'nothing to do' error
770
self.build_tree(['unknown'])
771
self.run_bzr_error(['Commit refused because there are unknown files'],
772
'commit', '--strict', '-m', 'my commit comment')
750
774
kwargs.setdefault('retcode', 3)
751
775
out, err = self.run_bzr(*args, **kwargs)