Skip to content

Commit

Permalink
Fixed the system test to skip if Theano is not installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
moorepants committed Dec 27, 2015
1 parent 4fd86a1 commit ce920d6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pydy/tests/test_system.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#!/usr/bin/env python

import warnings

import numpy as np
from numpy import testing
import sympy as sm
from sympy.physics.mechanics import dynamicsymbols
from scipy.integrate import odeint
theano = sm.external.import_module('theano')

from ..system import System
from ..models import multi_mass_spring_damper, n_link_pendulum_on_cart
from ..utils import sympy_equal_to_or_newer_than
from ..utils import sympy_equal_to_or_newer_than, PyDyImportWarning

SYMPY_VERSION = sm.__version__

warnings.simplefilter('once', PyDyImportWarning)

class TestSystem():

Expand Down Expand Up @@ -385,10 +389,14 @@ def test_integrate(self):

# Test a generator other than lambdify.
# -------------------------------------
sys.generate_ode_function(generator='theano')
sys.times = times
x_06 = sys.integrate()
testing.assert_allclose(x_04, x_06)
if theano:
sys.generate_ode_function(generator='theano')
sys.times = times
x_06 = sys.integrate()
testing.assert_allclose(x_04, x_06)
else:
warnings.warn("Theano was not found so the related tests are being"
" skipped.", PyDyImportWarning)

# Unrecognized generator.
# -----------------------
Expand Down

0 comments on commit ce920d6

Please sign in to comment.