diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2011-04-18 08:09:42 +0000 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2011-04-18 08:09:42 +0000 |
commit | 049cd7d4c08bd2d26a3eaaa591bd29ea28bfb807 (patch) | |
tree | 1bb205902c26f8f6f5fdaf344c5aac28de4f2176 /test | |
parent | 39574e44fd7cee2f024bdd06a5901ca0598606a0 (diff) | |
download | pysendfile-049cd7d4c08bd2d26a3eaaa591bd29ea28bfb807.tar.gz |
Fix some C warnings; fix python 2.4 compatibility broke in previous commits
Diffstat (limited to 'test')
-rw-r--r-- | test/test_sendfile.py | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/test/test_sendfile.py b/test/test_sendfile.py index 8f52687..8077f38 100644 --- a/test/test_sendfile.py +++ b/test/test_sendfile.py @@ -419,14 +419,15 @@ class TestLargeFile(unittest.TestCase): timer = RepeatedTimer(1, lambda: self.print_percent(total, BIGFILE_SIZE)) timer.start() try: - while 1: - f.write(chunk) - total += chunk_len - if total >= BIGFILE_SIZE: - break - except: - self.tearDown() - raise + try: + while 1: + f.write(chunk) + total += chunk_len + if total >= BIGFILE_SIZE: + break + except: + self.tearDown() + raise finally: f.close() timer.stop() @@ -440,17 +441,19 @@ class TestLargeFile(unittest.TestCase): file_size)) timer.start() try: - while 1: - sent = sendfile_wrapper(self.sockno, self.fileno, offset, nbytes) - if sent == 0: - break - total_sent += sent - offset += sent - self.assertTrue(sent <= nbytes) - self.assertEqual(offset, total_sent) - except: - print - raise + try: + while 1: + sent = sendfile_wrapper(self.sockno, self.fileno, offset, + nbytes) + if sent == 0: + break + total_sent += sent + offset += sent + self.assertTrue(sent <= nbytes) + self.assertEqual(offset, total_sent) + except: + print + raise finally: print timer.stop() |