From 48f4c8dba40cb2fe03a74a7a4d7d979892601ddc Mon Sep 17 00:00:00 2001
From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Mon, 21 Mar 2016 10:11:43 +0100
Subject: [PATCH] tests: use __file__ to determine library path

By using `os.path.dirname(__file__)` you can run the test from any directory/cwd and it will find the right path to the sample module. Without it you might accidentally import it from the wrong directory (i.e. if you have a development version of your project checked out, but you also have one installed in the system path, you may think that your tests pass when in fact they were testing the system installation rather than the development version).
---
 tests/context.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/context.py b/tests/context.py
index 349ae8a..91de701 100644
--- a/tests/context.py
+++ b/tests/context.py
@@ -2,6 +2,6 @@
 
 import sys
 import os
-sys.path.insert(0, os.path.abspath('..'))
+sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
 
-import sample
\ No newline at end of file
+import sample
-- 
GitLab