tcp: clear_log to clear socket logs

This commit is contained in:
Aldo Cortesi 2015-06-05 11:42:06 +12:00
parent 113c5c187f
commit 4ca62e0d9b
2 changed files with 5 additions and 0 deletions

View File

@ -126,6 +126,9 @@ class _FileLike(object):
if self.is_logging():
self._log.append(v)
def clear_log(self):
self._log = []
def reset_timestamps(self):
self.first_byte_timestamp = None

View File

@ -553,6 +553,8 @@ class TestFileLike:
assert s.get_log() == ""
s.read(1)
assert s.get_log() == "o"
s.clear_log()
assert s.get_log() == ""
s.stop_log()
tutils.raises(ValueError, s.get_log)