Skip to content

Commit

Permalink
skip numpy.random test if numpy not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
mmckerns committed Feb 12, 2023
1 parent 8d97e0d commit 02d0755
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pathos/tests/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
# - https://github.com/uqfoundation/pathos/blob/master/LICENSE

from pathos.pools import *
try:
import numpy
HASNUMPY = True
except ImportError:
HASNUMPY = False


def random(x):
from pathos.helpers import mp_helper as mp
Expand All @@ -27,8 +33,9 @@ def wrong2(x):
def check_random(pool):
res = pool.map(random, range(2))
assert res[0] != res[1]
res = pool.map(rand, range(2))
assert res[0] != res[1]
if HASNUMPY:
res = pool.map(rand, range(2))
assert res[0] != res[1]
pool.close()
pool.join()
pool.clear()
Expand All @@ -38,8 +45,9 @@ def check_random(pool):
def check_wrong(pool):
res = pool.map(wrong1, range(2))
assert res[0] == res[1]
res = pool.map(wrong2, range(2))
assert res[0] == res[1]
if HASNUMPY:
res = pool.map(wrong2, range(2))
assert res[0] == res[1]
pool.close()
pool.join()
pool.clear()
Expand Down

0 comments on commit 02d0755

Please sign in to comment.