add Gpu skip condition and setupclass in test_openclpow module

This commit is contained in:
navjot 2021-01-20 00:12:43 +05:30 committed by Muzahid
parent 27383ff635
commit 0283339138
Signed by untrusted user: cis-muzahid
GPG Key ID: 1DC85E7D3AB613EA

View File

@ -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")