]> CRI, Mines Paris - PSL - linpy.git/blobdiff - pypol/tests/libhelper.py
Helper module for sympy in unitary tests
[linpy.git] / pypol / tests / libhelper.py
diff --git a/pypol/tests/libhelper.py b/pypol/tests/libhelper.py
new file mode 100644 (file)
index 0000000..e75b4fb
--- /dev/null
@@ -0,0 +1,20 @@
+import functools
+import unittest
+
+try:
+
+    import sympy
+
+    def requires_sympy(func):
+        @functools.wraps(func)
+        def wrapper(self):
+            return func(self)
+        return wrapper
+
+except ImportError:
+
+    def requires_sympy(func):
+        @functools.wraps(func)
+        def wrapper(self):
+            raise unittest.SkipTest('SymPy is not available')
+        return wrapper