diff --git a/tracker/automated/test-tracker.py b/tracker/automated/test-tracker.py
index 0ab6b4ae9ba224c3cfe13ea9607168b84aaaef21..673537b4c45b4bd0ef4d10581324be2dda2f8f63 100755
--- a/tracker/automated/test-tracker.py
+++ b/tracker/automated/test-tracker.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # -*- coding: utf-8 -*-
 
 # Copyright © 2015 Collabora Ltd.
@@ -10,7 +10,7 @@
 
 import unittest
 import os
-import md5
+import hashlib
 import sys
 
 from gi.repository import GLib
@@ -76,7 +76,7 @@ class TrackerTest(unittest.TestCase):
         # Note that this is the path for local storage only, not for removable
         # devices.
         uri = 'file://%s/%s' % (self.homedir, filename)
-        uri_hash = md5.new(uri).hexdigest()
+        uri_hash = hashlib.md5(bytes(uri, encoding='UTF-8')).hexdigest()
         path = '%s/.cache/thumbnails/normal/%s.png' % (self.homedir, uri_hash)
         self.assertTrue(os.path.isfile(path))
 
diff --git a/tracker/common.py b/tracker/common.py
index 28a7de69608e23715956dc13c28a678d0839f751..c93b0b31dd381cbc0d9922e0e583b22a4d3fee04 100644
--- a/tracker/common.py
+++ b/tracker/common.py
@@ -28,7 +28,7 @@ class TrackerIndexer():
             'systemctl --user stop tracker-store tracker-miner-fs',
             shell=True)
         subprocess.check_call('tracker-control -r',
-                              stdout=open(os.devnull, 'wb'),
+                              stdout=subprocess.DEVNULL,
                               shell=True)
 
         self.loop = GLib.MainLoop.new(None, False)
diff --git a/tracker/manual/test-removable-device.py b/tracker/manual/test-removable-device.py
index 2f3d9ee4a67903a0faf11aafe09a14bbc134e279..41380d9b5f830701432c485c160bdf9d3c01aa90 100755
--- a/tracker/manual/test-removable-device.py
+++ b/tracker/manual/test-removable-device.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # -*- coding: utf-8 -*-
 
 # Copyright © 2015 Collabora Ltd.