diff --git a/test/nmap.uts b/test/nmap.uts
index d25228851e3a3e9df503f98050cf5679702ae52a..20003f7e86e7d9988edf957518b3d51aa378168a 100644
--- a/test/nmap.uts
+++ b/test/nmap.uts
@@ -10,8 +10,13 @@
 load_module('nmap')
 
 = Fetch database
-import urllib
-open('nmap-os-fingerprints', 'wb').write(urllib.urlopen('https://raw.githubusercontent.com/nmap/nmap/9efe1892/nmap-os-fingerprints').read())
+from __future__ import print_function
+try:
+    from urllib.request import urlopen
+except ImportError:
+    from urllib2 import urlopen
+
+open('nmap-os-fingerprints', 'wb').write(urlopen('https://raw.githubusercontent.com/nmap/nmap/9efe1892/nmap-os-fingerprints').read())
 conf.nmap_base = 'nmap-os-fingerprints'
 
 = Database loading
@@ -20,14 +25,14 @@ assert len(nmap_kdb.get_base()) > 100
 = fingerprint test: www.secdev.org
 ~ netaccess
 score, fprint = nmap_fp('www.secdev.org')
-print score, fprint
+print(score, fprint)
 assert score > 0.5
 assert fprint
 
 = fingerprint test: gateway
 ~ netaccess
 score, fprint = nmap_fp(conf.route.route('0.0.0.0')[2])
-print score, fprint
+print(score, fprint)
 assert score > 0.5
 assert fprint