From a2d53ccfb89dbdeb6fe3a531cd118c18ff5de1c3 Mon Sep 17 00:00:00 2001
From: madsmpedersen <m@madsp.dk>
Date: Fri, 29 Jan 2016 14:17:12 +0100
Subject: [PATCH] pytest runner

---
 tests/run_pytest.py |  8 ++++++++
 tests/testsuite.py  | 15 +++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)
 create mode 100644 tests/run_pytest.py

diff --git a/tests/run_pytest.py b/tests/run_pytest.py
new file mode 100644
index 0000000..a39f5c5
--- /dev/null
+++ b/tests/run_pytest.py
@@ -0,0 +1,8 @@
+'''
+Created on 29/01/2016
+
+@author: mmpe
+'''
+import pytest
+import os
+pytest.main(os.path.dirname(__file__) + "./../")
diff --git a/tests/testsuite.py b/tests/testsuite.py
index 73da007..9df434c 100644
--- a/tests/testsuite.py
+++ b/tests/testsuite.py
@@ -1,22 +1,21 @@
 import glob
 import unittest
 import os
-from os.path import dirname, relpath, abspath
+
 def module_strings():
-    test_file_paths = []
+    test_file_paths = glob.glob('test_*.py')
     #test_file_strings.extend(glob.glob('../wetb/**/test_*.py'))
     #for root,_,_ in os.walk("../wetb/"):
 
-    for folder, _, _ in os.walk(os.path.abspath(dirname(__file__) + '../wetb/')):
-        test_file_paths.extend(glob.glob(folder + "/tests/test_*.py"))
-    return [relpath(s, abspath(dirname(__file__) + "/../")).replace(".py", "").replace(os.path.sep, ".") for s in test_file_paths]
+    for folder, _, _ in os.walk('../wetb'):
+        test_file_paths.extend(glob.glob(os.path.join(folder, "tests/test_*.py")))
+    return [s[3:len(s) - 3].replace(os.path.sep, ".") for s in test_file_paths]
 
 
 def suite():
-    modules = module_strings()
-    suites = []
     try:
-        for s in modules:
+        suites = []
+        for s in module_strings():
             suites.append(unittest.defaultTestLoader.loadTestsFromName(s))
     except:
         print ("Failed to import '%s'" % s)
-- 
GitLab