Index: python/tests/test_filterbank.py
===================================================================
--- python/tests/test_filterbank.py	(revision 6db76007fdbbb97428dcf4255b2284bc5a0652f7)
+++ python/tests/test_filterbank.py	(revision 376d5e97103f3715d0ef89df155c14ffe6cbec09)
@@ -17,5 +17,5 @@
   def test_set_coeffs(self):
     f = filterbank(40, 512)
-    r = random.random([40, 512 / 2 + 1]).astype('float32')
+    r = random.random([40, int(512 / 2) + 1]).astype('float32')
     f.set_coeffs(r)
     assert_equal (r, f.get_coeffs())
@@ -36,5 +36,5 @@
     f = filterbank(40, 512)
     c = cvec(512)
-    c.norm[:] = random.random((512 / 2 + 1,)).astype('float32')
+    c.norm[:] = random.random((int(512 / 2) + 1,)).astype('float32')
     assert_equal( f(c), 0)
 
@@ -42,8 +42,8 @@
     f = filterbank(40, 512)
     c = cvec(512)
-    r = random.random([40, 512 / 2 + 1]).astype('float32')
+    r = random.random([40, int(512 / 2) + 1]).astype('float32')
     r /= r.sum()
     f.set_coeffs(r)
-    c.norm[:] = random.random((512 / 2 + 1,)).astype('float32')
+    c.norm[:] = random.random((int(512 / 2) + 1,)).astype('float32')
     assert_equal ( f(c) < 1., True )
     assert_equal ( f(c) > 0., True )
@@ -53,5 +53,5 @@
     c = cvec(512)
     f.set_mel_coeffs_slaney(44100)
-    c.norm[:] = random.random((512 / 2 + 1,)).astype('float32')
+    c.norm[:] = random.random((int(512 / 2) + 1,)).astype('float32')
     assert_equal ( f(c) < 1., True )
     assert_equal ( f(c) > 0., True )
Index: python/tests/test_note2midi.py
===================================================================
--- python/tests/test_note2midi.py	(revision 6db76007fdbbb97428dcf4255b2284bc5a0652f7)
+++ python/tests/test_note2midi.py	(revision 376d5e97103f3715d0ef89df155c14ffe6cbec09)
@@ -70,5 +70,5 @@
     def test_freq2note(self):
         " make sure freq2note(441) == A4 "
-        self.assertEquals("A4", freq2note(441))
+        self.assertEqual("A4", freq2note(441))
 
 if __name__ == '__main__':
Index: python/tests/test_phasevoc.py
===================================================================
--- python/tests/test_phasevoc.py	(revision 6db76007fdbbb97428dcf4255b2284bc5a0652f7)
+++ python/tests/test_phasevoc.py	(revision 376d5e97103f3715d0ef89df155c14ffe6cbec09)
@@ -31,5 +31,5 @@
         f = pvoc (win_s, hop_s)
         t = fvec (hop_s)
-        for time in range( 4 * win_s / hop_s ):
+        for time in range( int ( 4 * win_s / hop_s ) ):
             s = f(t)
             r = f.rdo(s)
Index: python/tests/test_zero_crossing_rate.py
===================================================================
--- python/tests/test_zero_crossing_rate.py	(revision 6db76007fdbbb97428dcf4255b2284bc5a0652f7)
+++ python/tests/test_zero_crossing_rate.py	(revision 376d5e97103f3715d0ef89df155c14ffe6cbec09)
@@ -23,22 +23,22 @@
     def test_impulse(self):
         """ check zero crossing rate on a buffer with an impulse """
-        self.vector[buf_size / 2] = 1.
+        self.vector[int(buf_size / 2)] = 1.
         self.assertEqual(0., zero_crossing_rate(self.vector))
 
     def test_negative_impulse(self):
         """ check zero crossing rate on a buffer with a negative impulse """
-        self.vector[buf_size / 2] = -1.
+        self.vector[int(buf_size / 2)] = -1.
         self.assertEqual(2./buf_size, zero_crossing_rate(self.vector))
 
     def test_single(self):
         """ check zero crossing rate on single crossing """
-        self.vector[buf_size / 2 - 1] = 1.
-        self.vector[buf_size / 2] = -1.
+        self.vector[int(buf_size / 2) - 1] = 1.
+        self.vector[int(buf_size / 2)] = -1.
         self.assertEqual(2./buf_size, zero_crossing_rate(self.vector))
 
     def test_single_with_gap(self):
         """ check zero crossing rate on single crossing with a gap"""
-        self.vector[buf_size / 2 - 2] = 1.
-        self.vector[buf_size / 2] = -1.
+        self.vector[int(buf_size / 2) - 2] = 1.
+        self.vector[int(buf_size / 2)] = -1.
         self.assertEqual(2./buf_size, zero_crossing_rate(self.vector))
 
Index: python/tests/utils.py
===================================================================
--- python/tests/utils.py	(revision 6db76007fdbbb97428dcf4255b2284bc5a0652f7)
+++ python/tests/utils.py	(revision 376d5e97103f3715d0ef89df155c14ffe6cbec09)
@@ -5,6 +5,8 @@
     from numpy import array
     filename = os.path.join(os.path.dirname(__file__), filename)
-    return array([line.split() for line in open(filename).readlines()],
-        dtype = dtype)
+    with open(filename) as f:
+        lines = f.readlines()
+    return array([line.split() for line in lines],
+            dtype = dtype)
 
 def list_all_sounds(rel_dir):
