aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-03-06 13:47:52 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:51 +0100
commit097c9ecf42d2724a074ea9e0d317ed5f38b5ca37 (patch)
tree78057eaf44781c335645e368af59c5be01000458 /unittest
parente4ff28a31b0cfd1821d0a7418aba5f71a1cffb8c (diff)
downloadlibnitrokey-097c9ecf42d2724a074ea9e0d317ed5f38b5ca37.tar.gz
libnitrokey-097c9ecf42d2724a074ea9e0d317ed5f38b5ca37.tar.bz2
Prefer to use log-enabled library in tests
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest')
-rw-r--r--unittest/conftest.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/unittest/conftest.py b/unittest/conftest.py
index f43f153..67b45aa 100644
--- a/unittest/conftest.py
+++ b/unittest/conftest.py
@@ -29,7 +29,23 @@ def C(request):
print(declaration)
ffi.cdef(declaration, override=True)
- C = ffi.dlopen("../build/libnitrokey.so")
+ C = None
+ import os, sys
+ path_build = os.path.join("..", "build")
+ paths = [ os.path.join(path_build,"libnitrokey-log.so"),
+ os.path.join(path_build,"libnitrokey.so")]
+ for p in paths:
+ print p
+ if os.path.exists(p):
+ C = ffi.dlopen(p)
+ break
+ else:
+ print("File does not exist: " + p)
+ print("Trying another")
+ if not C:
+ print("No library file found")
+ sys.exit(1)
+
C.NK_set_debug(False)
nk_login = C.NK_login_auto()
if nk_login != 1: