Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pygmo/_algorithm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def runTest(self):
self.run_name_info_tests()
self.run_thread_safety_tests()
self.run_pickle_tests()
self.run_scipy_wrapper_tests()

def run_basic_tests(self):
# Tests for minimal algorithm, and mandatory methods.
Expand Down Expand Up @@ -428,7 +427,16 @@ def run_pickle_tests(self):
self.assertTrue(a.is_(mbh))
self.assertTrue(a.extract(mbh).inner_algorithm.is_(_algo))

def run_scipy_wrapper_tests(self):
class algorithm_scipy_wrapper_tests(_ut.TestCase):
"""Test case for the :class:`~pygmo.algorithm` class with the scipy.optimize wrapper."""

def runTest(self):
try:
import scipy.version as _sc
except ImportError:
raise _ut.case.SkipTest("scipy module could not be imported")
del _sc

from . import (
ackley,
algorithm,
Expand Down
11 changes: 6 additions & 5 deletions pygmo/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,11 @@ def runTest(self):
from .core import free_form, topology, ring
except ImportError:
return

try:
import networkx as nx
except ImportError:
raise _ut.case.SkipTest("networkx module could not be imported")

# Default ctor.
udt = free_form()
Expand Down Expand Up @@ -693,11 +698,6 @@ def runTest(self):
self.assertTrue(len(topo.get_connections(3)[1]) == 0)
self.assertEqual(topo.get_name(), "Free form")

try:
import networkx as nx
except ImportError:
return

# Constructor from a valid DiGraph.
g = nx.DiGraph()
udt = free_form(g)
Expand Down Expand Up @@ -3429,6 +3429,7 @@ def run_test_suite(level=0):
suite.addTest(thread_island_torture_test_case())
suite.addTest(_problem_test.problem_test_case())
suite.addTest(_algorithm_test.algorithm_test_case())
suite.addTest(_algorithm_test.algorithm_scipy_wrapper_tests())
suite.addTest(_island_test.mp_island_test_case(level))
suite.addTest(_island_test.ipyparallel_island_test_case(level))
suite.addTest(golomb_ruler_test_case())
Expand Down