From 7b8bf082ff0d569f507d65e087000e4e3d6ccf3f Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 20 Jan 2021 00:12:43 +0530 Subject: [PATCH] add Gpu skip condition and setupclass in test_openclpow module --- src/tests/test_openclpow.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/tests/test_openclpow.py b/src/tests/test_openclpow.py index 384addb7..e98b7362 100644 --- a/src/tests/test_openclpow.py +++ b/src/tests/test_openclpow.py @@ -8,17 +8,23 @@ import pybitmessage.openclpow as openclpow from struct import pack, unpack +from test_process import TestProcessProto -class TestOpenClPow(unittest.TestCase): + +class TestOpenClPow(TestProcessProto): """ Main opencl test case """ - @unittest.skipIf(not openclpow.libAvailable, - "pyopencl is not installed") + @classmethod + def setUpClass(cls): + openclpow.initCL() + super(TestOpenClPow, cls).setUpClass() + + @unittest.skipIf(not openclpow.enabledGpus, + "No GPUs found / enabled") def test_openclpow(self): """Check the working of openclpow module""" - openclpow.initCL() target_ = 54227212183 initialHash = ("3758f55b5a8d902fd3597e4ce6a2d3f23daff735f65d9698c270987f4e67ad590" "b93f3ffeba0ef2fd08a8dc2f87b68ae5a0dc819ab57f22ad2c4c9c8618a43b3").decode("hex")