From 70f7b8b9888e72165faac1709faf2d00879ef497 Mon Sep 17 00:00:00 2001
From: Nicolas KAROLAK <nicolas@karolak.fr>
Date: Thu, 13 Sep 2018 11:46:26 +0200
Subject: [PATCH] fix(tests): absolute path append

---
 tests/test_email.py      | 3 ++-
 tests/test_postgresql.py | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/test_email.py b/tests/test_email.py
index 381bd2e5..ecdb84e7 100755
--- a/tests/test_email.py
+++ b/tests/test_email.py
@@ -5,6 +5,7 @@ Criticality: High
 Check that emails can be sent.
 """
 
+from pathlib import Path
 import os
 import subprocess
 import sys
@@ -22,7 +23,7 @@ except ImportError:
 if subprocess.call(["which", "netstat"]) != 0:
     subprocess.check_call(["apt-get", "-qq", "-y", "install", "net-tools"])
 
-sys.path.append("..")
+sys.path.append(str(Path(__file__).parents[1].resolve()))
 
 # pylint: disable=wrong-import-position
 from envsetup import utils as u  # noqa: E402
diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py
index 5767eca6..47dfae22 100755
--- a/tests/test_postgresql.py
+++ b/tests/test_postgresql.py
@@ -4,6 +4,7 @@ Criticality: High
 This test check the current state of the PostgreSQL database cluster.
 """
 
+from pathlib import Path
 import re
 import socket
 import subprocess
@@ -11,13 +12,13 @@ import sys
 import time
 import uuid
 
-sys.path.append("..")
-
 try:
     import psycopg2
 except ImportError:
     sys.exit(2)
 
+sys.path.append(str(Path(__file__).parents[1].resolve()))
+
 # pylint: disable=wrong-import-position
 from envsetup import utils as u  # noqa: E402
 
-- 
GitLab