Match the collected log lines against the regular expression self.expected_log_pat, and compare the extracted group values to the expected_values list of tuples.
(self, expected_values, stream=None, pat=None)
| 167 | threading_helper.threading_cleanup(*self._threading_key) |
| 168 | |
| 169 | def assert_log_lines(self, expected_values, stream=None, pat=None): |
| 170 | """Match the collected log lines against the regular expression |
| 171 | self.expected_log_pat, and compare the extracted group values to |
| 172 | the expected_values list of tuples.""" |
| 173 | stream = stream or self.stream |
| 174 | pat = re.compile(pat or self.expected_log_pat) |
| 175 | actual_lines = stream.getvalue().splitlines() |
| 176 | self.assertEqual(len(actual_lines), len(expected_values)) |
| 177 | for actual, expected in zip(actual_lines, expected_values): |
| 178 | match = pat.search(actual) |
| 179 | if not match: |
| 180 | self.fail("Log line does not match expected pattern:\n" + |
| 181 | actual) |
| 182 | self.assertEqual(tuple(match.groups()), expected) |
| 183 | s = stream.read() |
| 184 | if s: |
| 185 | self.fail("Remaining output at end of log stream:\n" + s) |
| 186 | |
| 187 | def next_message(self): |
| 188 | """Generate a message consisting solely of an auto-incrementing |
no test coverage detected