diff --git a/tests/test_apt_proxy.py b/tests/test_apt_proxy.py
index 5bb7e42f47138758269caee6a5b95c6dd222932e..66cbb931db012db0951ac5b2d5ae8d7fe5e4f6da 100755
--- a/tests/test_apt_proxy.py
+++ b/tests/test_apt_proxy.py
@@ -3,7 +3,7 @@
 # Copyright 2017, Florent Thiery
 '''
 Criticality: Normal
-Checks that packages mirror works for capture systems 
+Checks that packages mirror works for capture systems
 '''
 import os
 import sys
@@ -35,10 +35,10 @@ conf_servers = (
 for s in conf_servers:
     v = conf.get(s)
     try:
-        url = "https://%s/old-releases.ubuntu.com/ubuntu/dists/lucid/Release.gpg" % v
+        url = 'https://%s/old-releases.ubuntu.com/ubuntu/dists/lucid/Release.gpg' % v
         print('Checking url certificate %s' % url)
         d = requests.get(url, verify=False).text
-        if not "BEGIN PGP SIGNATURE" in d:
+        if 'BEGIN PGP SIGNATURE' not in d:
             all_ok = False
             print('%sUnexpected content: %s%s' % (RED, d, DEF))
         else:
diff --git a/tests/test_backup.py b/tests/test_backup.py
index bf45f087c6cb237a73ae70d12d4a620e9a197f96..00434ea3a0c843b609e4091737c0d4ddb23ba34a 100755
--- a/tests/test_backup.py
+++ b/tests/test_backup.py
@@ -3,7 +3,7 @@
 # Copyright 2017, Florent Thiery
 '''
 Criticality: Medium
-Checks that the server backups are not older than a day 
+Checks that the server backups are not older than a day.
 '''
 import os
 import sys
@@ -15,7 +15,6 @@ GREEN = '\033[92m'
 RED = '\033[91m'
 DEF = '\033[0m'
 
-os.chdir(os.path.dirname(__file__))
 
 def test_ssh(ip):
     cmd = 'ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no %s ls /tmp' % ip
@@ -28,6 +27,7 @@ def test_ssh(ip):
         return False
     return True
 
+
 def test_last_backup_is_recent(server, client):
     path = '/backup/%s/current' % client
     cmd = 'ssh -o StrictHostKeyChecking=no %s ls -l %s | grep current' % (server, path)
@@ -44,10 +44,12 @@ def test_last_backup_is_recent(server, client):
     else:
         return False
 
+
+os.chdir(os.path.dirname(__file__))
 if os.path.isfile('../utils.py'):
     es_utils = imp.load_source('es_utils', '../utils.py')
     conf = es_utils.load_conf()
-    BURP_SERVER = conf.get('BURP_SERVER') 
+    BURP_SERVER = conf.get('BURP_SERVER')
     BURP_CLIENT_NAME = conf.get('BURP_CLIENT_NAME', 'localhost')
     if BURP_SERVER:
         if not test_ssh(BURP_SERVER):