Skip to content

Commit

Permalink
Move test up
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Jul 6, 2016
1 parent 9d838e4 commit 49b7e02
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions nose/test_orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@
# Print all galpyWarnings always for tests of warnings
warnings.simplefilter("always",galpyWarning)

# Test that orbit integration in C gets interrupted by SIGINT (CTRL-C)
def test_orbit_c_sigint_full():
integrators= ['dopr54_c',
'leapfrog_c',
'rk4_c','rk6_c',
'symplec4_c','symplec6_c']
for integrator in integrators:
p= subprocess.Popen(['python','nose/orbitint4sigint.py',integrator,
'full'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
time.sleep(4)
os.kill(p.pid,signal.SIGINT)
time.sleep(4)
if p.poll() is None or p.poll() != 1:
for line in p.stderr.readlines(): print(line)
raise AssertionError("Full orbit integration using %s should have been interrupted by SIGINT (CTRL-C), but was not because p.poll() == %i" % (integrator,p.poll()))
return None

# Test whether the energy of simple orbits is conserved for different
# integrators
def test_energy_jacobi_conservation():
Expand Down Expand Up @@ -2788,26 +2808,6 @@ def test_orbit_method_inputobs_quantity():
assert numpy.fabs(o.W(obs=obs_units)-o.W(obs=obs)) < 10.**-8., 'Orbit method W does not return the correct value when input ro is Quantity'
return None

# Test that orbit integration in C gets interrupted by SIGINT (CTRL-C)
def test_orbit_c_sigint_full():
integrators= ['dopr54_c',
'leapfrog_c',
'rk4_c','rk6_c',
'symplec4_c','symplec6_c']
for integrator in integrators:
p= subprocess.Popen(['python','nose/orbitint4sigint.py',integrator,
'full'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
time.sleep(4)
os.kill(p.pid,signal.SIGINT)
time.sleep(4)
if p.poll() is None or p.poll() != 1:
for line in p.stderr.readlines(): print(line)
raise AssertionError("Full orbit integration using %s should have been interrupted by SIGINT (CTRL-C), but was not because p.poll() == %i" % (integrator,p.poll()))
return None

# Test that orbit integration in C gets interrupted by SIGINT (CTRL-C)
def test_orbit_c_sigint_planar():
integrators= ['dopr54_c',
Expand Down

0 comments on commit 49b7e02

Please sign in to comment.