From 69a09e2b5a00936d861749ed16c76d2e3ffc9dbd Mon Sep 17 00:00:00 2001
From: pwilczynskiclearcode
Date: Tue, 18 Nov 2014 21:38:09 +0100
Subject: [PATCH] Extend travis-ci tests with Python 3.4 and pypy.
---
.travis.yml | 4 ++++
statsd/client.py | 1 -
statsd/connection.py | 6 ++++++
statsd/timer.py | 1 -
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index fbf6a1d..0197193 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,12 @@
language: python
+
python:
- "2.6"
- "2.7"
- "3.3"
+ - "3.4"
+ - "pypy"
+ - "pypy3"
# command to install dependencies
install:
diff --git a/statsd/client.py b/statsd/client.py
index 3ed66fc..a7b19e5 100644
--- a/statsd/client.py
+++ b/statsd/client.py
@@ -117,4 +117,3 @@ def __repr__(self):
def _send(self, data):
return self.connection.send(data)
-
diff --git a/statsd/connection.py b/statsd/connection.py
index bc58165..8b60abf 100644
--- a/statsd/connection.py
+++ b/statsd/connection.py
@@ -80,6 +80,12 @@ def send(self, data, sample_rate=None):
self.logger.exception('unexpected error %r while sending data', e)
return False
+ def __del__(self):
+ '''
+ We close UDP socket connection explicitly for pypy.
+ '''
+ self.udp_sock.close()
+
def __repr__(self):
return '<%s[%s:%d] P(%.1f)>' % (
self.__class__.__name__,
diff --git a/statsd/timer.py b/statsd/timer.py
index ab6d450..5d55fec 100644
--- a/statsd/timer.py
+++ b/statsd/timer.py
@@ -96,7 +96,6 @@ def _decorator(*args, **kwargs):
finally:
# Stop the timer, send the message and cleanup
timer.stop('')
- del timer
return _decorator