From 097c9ecf42d2724a074ea9e0d317ed5f38b5ca37 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 6 Mar 2017 13:47:52 +0100 Subject: Prefer to use log-enabled library in tests Signed-off-by: Szczepan Zalega --- unittest/conftest.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3