add Gpu skip condition and setupclass in test_openclpow module

This commit is contained in:
navjot 2021-01-20 00:12:43 +05:30
parent 1612f9c778
commit 7b8bf082ff
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
1 changed files with 10 additions and 4 deletions

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