Vote count:
0
I want this to work correctly without buffering:
$ tail -f logfile | python parser.py
Previously I used:
for line in sys.stdin:
parse(line)
But now I have implemented http://ift.tt/1E3Gx7D :
while True:
line = sys.stdin.readline()
if not line: break # EOF
parse(line)
Question: I cannot think of a way to unit test my change without sleep(). How do I simulate a buffered filehandle?
asked 3 mins ago
How to simulate a buffered file handle for unit testing
Aucun commentaire:
Enregistrer un commentaire