def test_strict_proc_matching_false(self): assertInStdout( self.proc_output, self.EXPECTED_TEXT, "terminating_proc", strict_proc_matching=False )
def test_assertInStdout_notices_too_many_matching_procs(self): with self.assertRaisesRegex(Exception, "Found multiple processes") as cm: assertInStdout(self.proc_output, self.EXPECTED_TEXT, "terminating_proc") # Make sure the assertion method lists the names of the duplicate procs: self.assertIn("terminating_proc-1", str(cm.exception)) self.assertIn("terminating_proc-2", str(cm.exception)) self.assertIn("terminating_proc-3", str(cm.exception))
def test_assertInStdout_notices_no_matching_proc(self): with self.assertRaisesRegex(Exception, "Did not find any process") as cm: assertInStdout(self.proc_output, self.EXPECTED_TEXT, "bad_proc_name") print(cm.exception) # Make sure the assertion method lists the names of the process it does have: self.assertIn("terminating_proc-1", str(cm.exception)) self.assertIn("terminating_proc-2", str(cm.exception)) self.assertIn("terminating_proc-3", str(cm.exception))
def test_asserts_on_missing_text_by_proc(self): with self.assertRaisesRegex(AssertionError, self.NOT_FOUND_TEXT): assertInStdout(self.proc_output, self.NOT_FOUND_TEXT, self.proc_2)
def test_asserts_on_missing_text(self): with self.assertRaisesRegex(AssertionError, self.NOT_FOUND_TEXT): assertInStdout(self.proc_output, self.NOT_FOUND_TEXT, "terminating", NO_CMD_ARGS)
def test_arguments_disambiguate_processes(self): txt = self.EXPECTED_TEXT assertInStdout(self.proc_output, txt, "terminating_proc", "--extra") assertInStdout(self.proc_output, txt, "terminating_proc", "node:=different_name") assertInStdout(self.proc_output, txt, "terminating_proc", NO_CMD_ARGS)