mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Fix mod_random test on older distros
This commit is contained in:
parent
f232f7f9fe
commit
f8aeef25fc
@ -20,6 +20,10 @@ def __virtual__():
|
||||
'''
|
||||
Confirm this module is on a Debian based system
|
||||
'''
|
||||
# Certain versions of hashlib do not contain
|
||||
# the necessary functions
|
||||
if not hasattr(hashlib, 'algorithms'):
|
||||
return False
|
||||
return __virtualname__
|
||||
|
||||
|
||||
|
@ -29,6 +29,20 @@ mod_random.__context__ = {}
|
||||
mod_random.__opts__ = {}
|
||||
|
||||
|
||||
def _test_hashlib():
|
||||
try:
|
||||
import hashlib
|
||||
except ImportError:
|
||||
return False
|
||||
if not hasattr(hashlib, 'algorithms'):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
SUPPORTED_HASHLIB = _test_hashlib()
|
||||
|
||||
|
||||
@skipIf(not SUPPORTED_HASHLIB, 'Hashlib does not contain needed functionality')
|
||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||
class ModrandomTestCase(TestCase):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user