diff options
-rw-r--r-- | test/benchmark.py | 11 | ||||
-rw-r--r-- | test/test_sendfile.py | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/test/benchmark.py b/test/benchmark.py index 17b36f7..3fe4c3f 100644 --- a/test/benchmark.py +++ b/test/benchmark.py @@ -75,15 +75,15 @@ def safe_remove(file): class Spinner(threading.Thread): def run(self): - self._stop = False + self._exit = False self._spinner = itertools.cycle('-\|/') - while not self._stop: - sys.stdout.write(self._spinner.next() + "\b") + while not self._exit: + sys.stdout.write(next(self._spinner) + "\b") sys.stdout.flush() time.sleep(.1) def stop(self): - self._stop = True + self._exit = True self.join() @@ -121,6 +121,7 @@ def start_server(use_sendfile, keep_sending=False): sock.bind((HOST, PORT)) sock.listen(1) conn, addr = sock.accept() + sock.close() file = open(BIGFILE, 'rb') def on_exit(signum, fram): @@ -154,7 +155,7 @@ def start_server(use_sendfile, keep_sending=False): continue raise else: - if sent == 0: + if not sent: # EOF if keep_sending: offset = 0 diff --git a/test/test_sendfile.py b/test/test_sendfile.py index 65c5d33..223dcc5 100644 --- a/test/test_sendfile.py +++ b/test/test_sendfile.py @@ -273,7 +273,7 @@ class TestSendfile(unittest.TestCase): self.client.close() self.server.wait() data = self.server.handler_instance.get_data() - self.assertEqual(len(data), len(expected_expected_data)) + self.assertEqual(len(data), len(expected_data)) self.assertEqual(hash(data), hash(expected_data)) def test_trailer(self): |