Index: python/tests/test_fvec.py
===================================================================
--- python/tests/test_fvec.py	(revision 1c6fe64f5d251e305db3a7bb2f710a20cb00d8d2)
+++ python/tests/test_fvec.py	(revision 689106ecec1986332b7f2bbb30928e034b3b6de2)
@@ -20,5 +20,5 @@
         assert a.dtype == 'float32'
         assert a.shape == (4,)
-        assert_equal (range(4), a)
+        assert_equal (list(range(4)), a)
 
     def test_vector_assign_element(self):
@@ -42,5 +42,5 @@
         a.T
         array(a).T
-        a = range(len(a))
+        a = list(range(len(a)))
 
     def test_wrong_values(self):
@@ -53,9 +53,9 @@
     def test_alpha_norm_of_fvec(self):
         a = fvec(2)
-        self.assertEquals (alpha_norm(a, 1), 0)
+        self.assertEqual (alpha_norm(a, 1), 0)
         a[0] = 1
-        self.assertEquals (alpha_norm(a, 1), 0.5)
+        self.assertEqual (alpha_norm(a, 1), 0.5)
         a[1] = 1
-        self.assertEquals (alpha_norm(a, 1), 1)
+        self.assertEqual (alpha_norm(a, 1), 1)
         a = array([0, 1], dtype='float32')
         from math import sqrt
@@ -74,5 +74,5 @@
         # check 1d array
         a = array(range(10), dtype = 'float32')
-        self.assertEquals (alpha_norm(a, 1), 4.5)
+        self.assertEqual (alpha_norm(a, 1), 4.5)
 
     def test_alpha_norm_of_array_of_int(self):
@@ -92,9 +92,9 @@
         assert_almost_equal (zero_crossing_rate(a), 1./3. )
         a = array([0.]*100, dtype='float32')
-        self.assertEquals (zero_crossing_rate(a), 0 )
+        self.assertEqual (zero_crossing_rate(a), 0 )
         a = array([-1.]*100, dtype='float32')
-        self.assertEquals (zero_crossing_rate(a), 0 )
+        self.assertEqual (zero_crossing_rate(a), 0 )
         a = array([1.]*100, dtype='float32')
-        self.assertEquals (zero_crossing_rate(a), 0 )
+        self.assertEqual (zero_crossing_rate(a), 0 )
 
     def test_alpha_norm_of_array_of_float64(self):
@@ -106,8 +106,8 @@
         self.assertRaises (ValueError, alpha_norm, a, 1)
         # check float64 1d array fail
-        a = array(range(10), dtype = 'float64')
+        a = array(list(range(10)), dtype = 'float64')
         self.assertRaises (ValueError, alpha_norm, a, 1)
         # check float64 2d array fail
-        a = array([range(10), range(10)], dtype = 'float64')
+        a = array([list(range(10)), list(range(10))], dtype = 'float64')
         self.assertRaises (ValueError, alpha_norm, a, 1)
 
Index: python/tests/test_mathutils.py
===================================================================
--- python/tests/test_mathutils.py	(revision 1c6fe64f5d251e305db3a7bb2f710a20cb00d8d2)
+++ python/tests/test_mathutils.py	(revision 689106ecec1986332b7f2bbb30928e034b3b6de2)
@@ -13,5 +13,5 @@
         unwrap2pi(int(23))
         unwrap2pi(float(23.))
-        unwrap2pi(long(23.))
+        unwrap2pi(int(23.))
         unwrap2pi(arange(10))
         unwrap2pi(arange(10).astype("int"))
@@ -28,6 +28,6 @@
 
         try:
-            print unwrap2pi(["23.","24.",25.])
-        except Exception, e:
+            print (unwrap2pi(["23.","24.",25.]))
+        except Exception as e:
             pass
 
@@ -54,5 +54,5 @@
 
     def test_freqtomidi(self):
-        a = array(range(-20, 50000, 100) + [ -1e32, 1e32 ])
+        a = array(list(range(-20, 50000, 100)) + [ -1e32, 1e32 ])
         b = freqtomidi(a)
         #print zip(a, b)
@@ -62,5 +62,5 @@
 
     def test_miditofreq(self):
-        a = range(-30, 200) + [-100000, 10000]
+        a = list(range(-30, 200)) + [-100000, 10000]
         b = miditofreq(a)
         #print zip(a, b)
@@ -70,5 +70,5 @@
 
     def test_miditobin(self):
-        a = range(-30, 200) + [-100000, 10000]
+        a = list(range(-30, 200)) + [-100000, 10000]
         b = [ bintomidi(x, 44100, 512) for x in a ]
         #print zip(a, b)
@@ -78,5 +78,5 @@
 
     def test_bintomidi(self):
-        a = range(-100, 512)
+        a = list(range(-100, 512))
         b = [ bintomidi(x, 44100, 512) for x in a ]
         #print zip(a, b)
@@ -86,5 +86,5 @@
 
     def test_freqtobin(self):
-        a = range(-20, 50000, 100) + [ -1e32, 1e32 ]
+        a = list(range(-20, 50000, 100)) + [ -1e32, 1e32 ]
         b = [ freqtobin(x, 44100, 512) for x in a ]
         #print zip(a, b)
@@ -94,5 +94,5 @@
 
     def test_bintofreq(self):
-        a = range(-20, 148)
+        a = list(range(-20, 148))
         b = [ bintofreq(x, 44100, 512) for x in a ]
         #print zip(a, b)
Index: python/tests/test_musicutils.py
===================================================================
--- python/tests/test_musicutils.py	(revision 1c6fe64f5d251e305db3a7bb2f710a20cb00d8d2)
+++ python/tests/test_musicutils.py	(revision 689106ecec1986332b7f2bbb30928e034b3b6de2)
@@ -18,5 +18,5 @@
         try:
             window(10, 1024)
-        except ValueError, e:
+        except ValueError as e:
             pass
         else:
@@ -26,5 +26,5 @@
         try:
             window("default", "default")
-        except ValueError, e:
+        except ValueError as e:
             pass
         else:
@@ -44,5 +44,5 @@
         try:
             level_lin("default")
-        except ValueError, e:
+        except ValueError as e:
             pass
         else:
@@ -63,5 +63,5 @@
         try:
             db_spl("default")
-        except ValueError, e:
+        except ValueError as e:
             pass
         else:
@@ -83,5 +83,5 @@
         try:
             silence_detection("default", -70)
-        except ValueError, e:
+        except ValueError as e:
             pass
         else:
@@ -103,5 +103,5 @@
         try:
             level_detection("default", -70)
-        except ValueError, e:
+        except ValueError as e:
             pass
         else:
Index: python/tests/test_phasevoc.py
===================================================================
--- python/tests/test_phasevoc.py	(revision 1c6fe64f5d251e305db3a7bb2f710a20cb00d8d2)
+++ python/tests/test_phasevoc.py	(revision 689106ecec1986332b7f2bbb30928e034b3b6de2)
@@ -64,5 +64,5 @@
         zeros = fvec(hop_s)
         f = pvoc(buf_s, hop_s)
-        for i in xrange(hop_s):
+        for i in range(hop_s):
             sigin[i] = random() * 2. - 1.
         t2 = f.rdo( f(sigin) )
Index: python/tests/test_pitch.py
===================================================================
--- python/tests/test_pitch.py	(revision 1c6fe64f5d251e305db3a7bb2f710a20cb00d8d2)
+++ python/tests/test_pitch.py	(revision 689106ecec1986332b7f2bbb30928e034b3b6de2)
@@ -25,5 +25,5 @@
         p = pitch('default', 2048, 512, 32000)
         f = fvec (512)
-        for i in xrange(10): assert_equal (p(f), 0.)
+        for i in range(10): assert_equal (p(f), 0.)
 
     def test_run_on_ones(self):
@@ -32,5 +32,5 @@
         f = fvec (512)
         f[:] = 1
-        for i in xrange(10): assert_equal (p(f), 0.)
+        for i in range(10): assert_equal (p(f), 0.)
 
 class aubio_pitch_Sinusoid(TestCase):
Index: python/tests/test_sink.py
===================================================================
--- python/tests/test_sink.py	(revision 1c6fe64f5d251e305db3a7bb2f710a20cb00d8d2)
+++ python/tests/test_sink.py	(revision 689106ecec1986332b7f2bbb30928e034b3b6de2)
@@ -45,5 +45,5 @@
                     vec = fvec(write)
                     g(vec, write)
-        except StandardError:
+        except Exception:
             pass
         else:
@@ -71,9 +71,9 @@
                     if read < f.hop_size: break
                 if 0:
-                    print "read", "%.2fs" % (total_frames / float(f.samplerate) ),
-                    print "(", total_frames, "frames", "in",
-                    print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",
-                    print "from", f.uri,
-                    print "to", g.uri
+                    print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ),
+                    print ("(", total_frames, "frames", "in" ),
+                    print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ),
+                    print ("from", f.uri ),
+                    print ("to", g.uri)
                 del_tmp_sink_path(sink_path)
 
@@ -96,11 +96,11 @@
                     if read < f.hop_size: break
                 if 0:
-                    print "read", "%.2fs" % (total_frames / float(f.samplerate) ),
-                    print "(", total_frames, "frames", "in",
-                    print f.channels, "channels", "in",
-                    print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",
-                    print "from", f.uri,
-                    print "to", g.uri,
-                    print "in", g.channels, "channels"
+                    print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ),
+                    print ("(", total_frames, "frames", "in" ),
+                    print (f.channels, "channels", "in" ),
+                    print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ),
+                    print ("from", f.uri ),
+                    print ("to", g.uri ),
+                    print ("in", g.channels, "channels")
                 del_tmp_sink_path(sink_path)
 
Index: python/tests/test_source.py
===================================================================
--- python/tests/test_source.py	(revision 1c6fe64f5d251e305db3a7bb2f710a20cb00d8d2)
+++ python/tests/test_source.py	(revision 689106ecec1986332b7f2bbb30928e034b3b6de2)
@@ -39,8 +39,8 @@
             total_frames += read
             if read < f.hop_size: break
-        print "read", "%.2fs" % (total_frames / float(f.samplerate) ),
-        print "(", total_frames, "frames", "in",
-        print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",
-        print "from", f.uri
+        print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ),
+        print ("(", total_frames, "frames", "in" ),
+        print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ),
+        print ("from", f.uri)
         return total_frames
 
@@ -68,5 +68,5 @@
             try:
                 f = source(p, -1)
-            except ValueError, e:
+            except ValueError as e:
                 pass
             else:
@@ -77,5 +77,5 @@
             try:
                 f = source(p, 0, -1)
-            except ValueError, e:
+            except ValueError as e:
                 pass
             else:
@@ -109,9 +109,9 @@
             total_frames += read
             if read < f.hop_size: break
-        print "read", "%.2fs" % (total_frames / float(f.samplerate) ),
-        print "(", total_frames, "frames", "in",
-        print f.channels, "channels and",
-        print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")",
-        print "from", f.uri
+        print ("read", "%.2fs" % (total_frames / float(f.samplerate) ) ),
+        print ("(", total_frames, "frames", "in" ),
+        print (f.channels, "channels and" ),
+        print (total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")" ),
+        print ("from", f.uri)
         return total_frames
 
