diff --git a/tests/test_dns_records.py b/tests/test_dns_records.py
index 469b0181b4d274d7ffa216e362f13703ea02ba3b..fb2b4d59ac5ff91ab2387a4b43f15d8aa49d4084 100755
--- a/tests/test_dns_records.py
+++ b/tests/test_dns_records.py
@@ -13,6 +13,7 @@ GREEN = '\033[92m'
 RED = '\033[91m'
 DEF = '\033[0m'
 
+
 def get_dns_servers():
     servers = list()
     with open('/etc/resolv.conf', 'r') as f:
@@ -24,11 +25,13 @@ def get_dns_servers():
 
 resolvers = get_dns_servers()
 
+
 def get_result(output):
     for line in output.split('\n'):
         if "has address " in line:
             return line.split("has address ")[1]
 
+
 def check_dns(hostname, expected_ip):
     all_ok = True
     for resolver in resolvers:
@@ -48,6 +51,8 @@ def check_dns(hostname, expected_ip):
         print('%sDNS resolution of %s on server %s returned %s%s' % (color, hostname, resolver, address, DEF))
     return all_ok
 
+
+os.chdir(os.path.dirname(__file__))
 if os.path.isfile('../utils.py'):
     all_ok = True
     es_utils = imp.load_source('es_utils', '../utils.py')