You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
MESA r2208 fails some of its tests, because #933 changed the timestepping logic but didn't update the tests. If I revert 5ee20a0 then they pass, so the code is not broken, just the tests.
To Reproduce
Once the new build system is merged:
edit src/amuse_mesa_r2208/tests/test_mesa_2208.py
remove the skip statements from the following tests:
TestMESAInterface.test4
TestMESA.test2
TestMESA.test5
TestMESA.test11
TestMESA.test12
TestMESA.test16
TestMESA.test22
from the top directory, run ./setup test mesa_r2208
(or run make test-amuse-mesa_r2208 from src/amuse_mesa_r2208
Expected behavior
The tests are expected to pass.
Logs
amuse$ ./setup test mesa_r2208
Checking for dependencies, one moment please...
Testing amuse-mesa_r2208...
make: Entering directory '/home/lourens/NLeSC/projects/ReDiTSAp/software/amuse/src/amuse/community/mesa_r2208'
cd packages/amuse-mesa_r2208 && pytest
============================= test session starts ==============================
platform linux -- Python 3.12.4, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/lourens/NLeSC/projects/ReDiTSAp/software/amuse/src/amuse/community/mesa_r2208/packages/amuse-mesa_r2208
configfile: pyproject.toml
testpaths: mesa_r2208/tests
collected 27 items
mesa_r2208/tests/test_mesa_2208.py ..F.....FF..Fs..F.F....F... [100%]
=================================== FAILURES ===================================
___________________________ TestMESAInterface.test4 ____________________________
self = <test_mesa_2208.TestMESAInterface testMethod=test4>
def test4(self):
print("Testing basic operations: evolve...")
instance = self.new_instance_of_an_optional_code(MESAInterface)
if instance is None:
print("MESA was not built. Skipping test.")
return
instance.set_MESA_paths(instance.default_path_to_inlist,
instance.default_path_to_MESA_data, instance.get_output_directory())
status = instance.initialize_code()
(index_of_the_star, error) = instance.new_particle(1.0)
self.assertEqual(0, error)
self.assertEqual(index_of_the_star, 1)
self.assertEqual(0, instance.commit_particles())
initial_dt = 1.0e5
dt_factor = 1.2
self.assertEqual([initial_dt, 0], list(instance.get_time_step(index_of_the_star).values()))
self.assertEqual(0, instance.evolve_one_step(index_of_the_star))
self.assertEqual([initial_dt, 0], list(instance.get_age(index_of_the_star).values()))
target_end_time = 3.0e5 # (years)
self.assertEqual(0, instance.evolve_for(index_of_the_star, target_end_time-initial_dt))
> self.assertEqual([initial_dt*(1 + dt_factor + dt_factor**2), 0], list(instance.get_age(index_of_the_star).values()))
mesa_r2208/tests/test_mesa_2208.py:104:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../../tests/amusetest.py:86: in failUnlessEqual
self._raise_exceptions_if_any(failures, first, second, '{0} != {1}', msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_mesa_2208.TestMESAInterface testMethod=test4>
failures = array([ True], dtype=bool), first = [364000.0, 0]
second = [300000.0, 0], err_fmt_string = '{0} != {1}', msg = None, args = ()
def _raise_exceptions_if_any(self, failures, first, second, err_fmt_string, msg, *args):
if len(failures) == 1:
if failures[0]:
> raise self.failureException(msg or err_fmt_string.format(first, second, *args))
E AssertionError: [364000.0, 0] != [300000.0, 0]
../../../../../tests/amusetest.py:73: AssertionError
----------------------------- Captured stdout call -----------------------------
Testing basic operations: evolve...
_______________________________ TestMESA.test11 ________________________________
self = <test_mesa_2208.TestMESA testMethod=test11>
def test11(self):
print("Test evolve_model optional arguments: end_time and keep_synchronous")
stars = Particles(3)
stars.mass = [1.0, 2.0, 3.0] | units.MSun
instance = self.new_instance_of_an_optional_code(MESA)
if instance is None:
print("MESA was not built. Skipping test.")
return
instance.initialize_code()
instance.commit_parameters()
instance.particles.add_particles(stars)
instance.commit_particles()
self.assertAlmostEqual(instance.particles.age, [0.0, 0.0, 0.0] | units.yr)
self.assertAlmostEqual(instance.particles.time_step, [100000.0, 17677.6695, 6415.0029] | units.yr, 3)
print("evolve_model without arguments: use shared timestep = 0.99*min(particles.time_step)")
instance.evolve_model()
> self.assertAlmostEqual(instance.particles.age, [100000.0, 17677.6695, 6415.0029] | units.yr, 3)
mesa_r2208/tests/test_mesa_2208.py:633:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../../tests/amusetest.py:108: in failUnlessAlmostEqual
self._raise_exceptions_if_any(failures, first, second, '{0} != {1} within {2} places', msg, places)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_mesa_2208.TestMESA testMethod=test11>
failures = array([ True, True, True], dtype=bool)
first = quantity<[6350.71731973, 6350.71731973, 6350.71731973] yr>
second = quantity<[100000.0, 17677.6695, 6415.0029] yr>
err_fmt_string = '{0} != {1} within {2} places', msg = None, args = (3,)
err_list = ['@0, 6350.71731973 yr != 100000.0 yr within 3 places', '@1, 6350.71731973 yr != 17677.6695 yr within 3 places', '@2, 6350.71731973 yr != 6415.0029 yr within 3 places']
def _raise_exceptions_if_any(self, failures, first, second, err_fmt_string, msg, *args):
if len(failures) == 1:
if failures[0]:
raise self.failureException(msg or err_fmt_string.format(first, second, *args))
elif any(failures):
first, second = self._convert_to_vectors(first, second)
err_list = [("@{0}, ".format(i)+err_fmt_string.format(first[i], second[i], *args))
for (i,b) in enumerate(failures) if b]
err = '\n'.join(err_list)
> raise self.failureException(msg or err)
E AssertionError: @0, 6350.71731973 yr != 100000.0 yr within 3 places
E @1, 6350.71731973 yr != 17677.6695 yr within 3 places
E @2, 6350.71731973 yr != 6415.0029 yr within 3 places
../../../../../tests/amusetest.py:79: AssertionError
----------------------------- Captured stdout call -----------------------------
Test evolve_model optional arguments: end_time and keep_synchronous
evolve_model without arguments: use shared timestep = 0.99*min(particles.time_step)
_______________________________ TestMESA.test12 ________________________________
self = <test_mesa_2208.TestMESA testMethod=test12>
def test12(self):
print("Test for importing new stellar models")
star = Particles(1)
star.mass = 1.0 | units.MSun
instance = self.new_instance_of_an_optional_code(MESA)
if instance is None:
print("MESA was not built. Skipping test.")
return
instance.initialize_code()
instance.parameters.stabilize_new_stellar_model_flag = False
instance.commit_parameters()
instance.particles.add_particles(star)
instance.commit_particles()
instance.evolve_model()
number_of_zones = instance.particles[0].get_number_of_zones()
composition = instance.particles[0].get_chemical_abundance_profiles(number_of_zones=number_of_zones)
instance.new_particle_from_model(dict(
mass=instance.particles[0].get_cumulative_mass_profile(number_of_zones=number_of_zones) * instance.particles[0].mass,
radius=instance.particles[0].get_radius_profile(number_of_zones=number_of_zones),
rho=instance.particles[0].get_density_profile(number_of_zones=number_of_zones),
temperature=instance.particles[0].get_temperature_profile(number_of_zones=number_of_zones),
luminosity=instance.particles[0].get_luminosity_profile(number_of_zones=number_of_zones),
X_H=composition[0],
X_He=composition[1] + composition[2],
X_C=composition[3],
X_N=composition[4],
X_O=composition[5],
X_Ne=composition[6],
X_Mg=composition[7],
X_Si=composition[7]*0.0,
X_Fe=composition[7]*0.0), 10.0 | units.Myr)
self.assertEqual(len(instance.particles), 2)
self.assertEqual(len(instance.imported_stars), 1)
self.assertEqual(instance.imported_stars[0].get_number_of_zones(), number_of_zones)
self.assertIsOfOrder(instance.imported_stars[0].get_radius_profile()[-1], 1.0 | units.RSun)
self.assertIsOfOrder(instance.imported_stars[0].get_temperature_profile()[0], 1.0e7 | units.K)
self.assertIsOfOrder(instance.imported_stars[0].get_pressure_profile()[0], 1.0e17 | units.barye)
self.assertAlmostEqual(instance.imported_stars[0].get_mass_profile(),
instance.native_stars[0].get_mass_profile())
self.assertAlmostRelativeEqual(instance.imported_stars[0].get_pressure_profile(),
instance.native_stars[0].get_pressure_profile(), 7)
> self.assertAlmostEqual(instance.imported_stars[0].get_radius_profile(),
instance.native_stars[0].get_radius_profile())
mesa_r2208/tests/test_mesa_2208.py:693:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../../tests/amusetest.py:108: in failUnlessAlmostEqual
self._raise_exceptions_if_any(failures, first, second, '{0} != {1} within {2} places', msg, places)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_mesa_2208.TestMESA testMethod=test12>
failures = array([False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False,..., False, False, False, False, False, False,
False, False, False, False, False, False, False, False], dtype=bool)
first = quantity<[67388590.0786, 84904416.7202, 102769761.664, 115947573.622, 135820802.936, 163852546.755, 201540458.836, 250...8174108.6, 62188881218.3, 62189626738.0, 62190074300.9, 62190538081.3, 62191019701.5, 62191521004.2, 62191727538.4] cm>
second = quantity<[67388590.0786, 84904416.7202, 102769761.664, 115947573.622, 135820802.936, 163852546.755, 201540458.836, 250...8174108.6, 62188881218.3, 62189626738.0, 62190074300.9, 62190538081.3, 62191019701.5, 62191521004.2, 62191727538.4] cm>
err_fmt_string = '{0} != {1} within {2} places', msg = None, args = (7,)
err_list = ['@33, 6229560583.47 cm != 6229560583.47 cm within 7 places', '@34, 6376928093.49 cm != 6376928093.49 cm within 7 plac...795750812.27 cm != 6795750812.27 cm within 7 places', '@38, 6931080621.43 cm != 6931080621.43 cm within 7 places', ...]
def _raise_exceptions_if_any(self, failures, first, second, err_fmt_string, msg, *args):
if len(failures) == 1:
if failures[0]:
raise self.failureException(msg or err_fmt_string.format(first, second, *args))
elif any(failures):
first, second = self._convert_to_vectors(first, second)
err_list = [("@{0}, ".format(i)+err_fmt_string.format(first[i], second[i], *args))
for (i,b) in enumerate(failures) if b]
err = '\n'.join(err_list)
> raise self.failureException(msg or err)
E AssertionError: @33, 6229560583.47 cm != 6229560583.47 cm within 7 places
E @34, 6376928093.49 cm != 6376928093.49 cm within 7 places
E @35, 6518689701.28 cm != 6518689701.28 cm within 7 places
E @36, 6659646621.37 cm != 6659646621.37 cm within 7 places
E @37, 6795750812.27 cm != 6795750812.27 cm within 7 places
E @38, 6931080621.43 cm != 6931080621.43 cm within 7 places
E @39, 7062168167.18 cm != 7062168167.18 cm within 7 places
E @40, 7319126722.88 cm != 7319126722.88 cm within 7 places
E @41, 7459720925.61 cm != 7459720925.61 cm within 7 places
E @42, 7596193103.51 cm != 7596193103.51 cm within 7 places
E @43, 7719697776.34 cm != 7719697776.34 cm within 7 places
E @44, 7840170023.16 cm != 7840170023.16 cm within 7 places
E @45, 8069992269.54 cm != 8069992269.54 cm within 7 places
E @46, 8170627727.06 cm != 8170627727.06 cm within 7 places
E @47, 8269421766.32 cm != 8269421766.32 cm within 7 places
E @48, 8325629670.59 cm != 8325629670.59 cm within 7 places
E @49, 8381277605.86 cm != 8381277605.86 cm within 7 places
E @50, 8413313195.52 cm != 8413313195.52 cm within 7 places
E @51, 8460563249.29 cm != 8460563249.29 cm within 7 places
E @52, 8507428685.32 cm != 8507428685.32 cm within 7 places
E @53, 8600046194.0 cm != 8600046194.0 cm within 7 places
E @54, 8707161417.79 cm != 8707161417.79 cm within 7 places
E @55, 8918446763.28 cm != 8918446763.28 cm within 7 places
E @56, 9022612814.34 cm != 9022612814.34 cm within 7 places
E @57, 9125136167.98 cm != 9125136167.98 cm within 7 places
E @58, 9227100963.21 cm != 9227100963.21 cm within 7 places
E @59, 9327559387.77 cm != 9327559387.77 cm within 7 places
E @60, 9526011781.83 cm != 9526011781.83 cm within 7 places
E @61, 9720738710.06 cm != 9720738710.06 cm within 7 places
E @62, 9816939239.58 cm != 9816939239.58 cm within 7 places
E @63, 9911963630.22 cm != 9911963630.22 cm within 7 places
E @64, 10099913560.0 cm != 10099913560.0 cm within 7 places
E @65, 10284772396.0 cm != 10284772396.0 cm within 7 places
E @66, 10466717586.2 cm != 10466717586.2 cm within 7 places
E @67, 10645910597.2 cm != 10645910597.2 cm within 7 places
E @68, 10822501287.4 cm != 10822501287.4 cm within 7 places
E @69, 10996626740.4 cm != 10996626740.4 cm within 7 places
E @70, 11168417121.6 cm != 11168417121.6 cm within 7 places
E @71, 11337990627.0 cm != 11337990627.0 cm within 7 places
E @72, 11505457762.4 cm != 11505457762.4 cm within 7 places
E @73, 11670923644.6 cm != 11670923644.6 cm within 7 places
E @74, 11834486753.7 cm != 11834486753.7 cm within 7 places
E @75, 11996237276.1 cm != 11996237276.1 cm within 7 places
E @169, 24289306532.3 cm != 24289306532.3 cm within 7 places
E @170, 24478707295.1 cm != 24478707295.1 cm within 7 places
E @171, 24671255032.9 cm != 24671255032.9 cm within 7 places
E @172, 24801144844.6 cm != 24801144844.6 cm within 7 places
E @173, 25014462830.0 cm != 25014462830.0 cm within 7 places
E @174, 25136968406.1 cm != 25136968406.1 cm within 7 places
E @175, 25312540230.5 cm != 25312540230.5 cm within 7 places
E @176, 25522782659.3 cm != 25522782659.3 cm within 7 places
E @177, 25756861663.4 cm != 25756861663.4 cm within 7 places
E @178, 25888704483.0 cm != 25888704483.0 cm within 7 places
E @179, 26084706657.6 cm != 26084706657.6 cm within 7 places
E @180, 26380758310.5 cm != 26380758310.5 cm within 7 places
E @181, 26575459846.8 cm != 26575459846.8 cm within 7 places
E @182, 26890885963.9 cm != 26890885963.9 cm within 7 places
E @183, 27131841417.6 cm != 27131841417.6 cm within 7 places
E @184, 27294251131.8 cm != 27294251131.8 cm within 7 places
E @185, 27554566872.8 cm != 27554566872.8 cm within 7 places
E @186, 27804334445.4 cm != 27804334445.4 cm within 7 places
E @187, 28054477425.2 cm != 28054477425.2 cm within 7 places
E @188, 28305000021.2 cm != 28305000021.2 cm within 7 places
E @189, 28555905478.5 cm != 28555905478.5 cm within 7 places
E @190, 28807195504.7 cm != 28807195504.7 cm within 7 places
E @191, 29058871338.2 cm != 29058871338.2 cm within 7 places
E @192, 29310932629.4 cm != 29310932629.4 cm within 7 places
E @193, 29563376589.9 cm != 29563376589.9 cm within 7 places
E @194, 29816203447.2 cm != 29816203447.2 cm within 7 places
E @195, 30069407489.2 cm != 30069407489.2 cm within 7 places
E @196, 30322986262.8 cm != 30322986262.8 cm within 7 places
E @197, 30576933173.5 cm != 30576933173.5 cm within 7 places
E @198, 30831241449.0 cm != 30831241449.0 cm within 7 places
E @199, 31085904019.5 cm != 31085904019.5 cm within 7 places
E @200, 31337811108.1 cm != 31337811108.1 cm within 7 places
E @201, 31715449675.7 cm != 31715449675.7 cm within 7 places
E @202, 32108049464.7 cm != 32108049464.7 cm within 7 places
E @203, 32422241347.1 cm != 32422241347.1 cm within 7 places
E @204, 32740533704.0 cm != 32740533704.0 cm within 7 places
E @205, 33135073000.8 cm != 33135073000.8 cm within 7 places
E @206, 33389205186.4 cm != 33389205186.4 cm within 7 places
E @207, 33650064965.9 cm != 33650064965.9 cm within 7 places
E @208, 33904585486.7 cm != 33904585486.7 cm within 7 places
E @209, 34165865455.5 cm != 34165865455.5 cm within 7 places
E @210, 34420699756.4 cm != 34420699756.4 cm within 7 places
E @211, 34682318588.3 cm != 34682318588.3 cm within 7 places
E @212, 35199392728.5 cm != 35199392728.5 cm within 7 places
E @213, 35454588693.6 cm != 35454588693.6 cm within 7 places
E @214, 35716585257.7 cm != 35716585257.7 cm within 7 places
E @215, 36233946596.3 cm != 36233946596.3 cm within 7 places
E @216, 36751065773.6 cm != 36751065773.6 cm within 7 places
E @217, 37005914935.5 cm != 37005914935.5 cm within 7 places
E @218, 37267508907.9 cm != 37267508907.9 cm within 7 places
E @219, 37783265732.6 cm != 37783265732.6 cm within 7 places
E @220, 38037176303.4 cm != 38037176303.4 cm within 7 places
E @221, 38297752555.9 cm != 38297752555.9 cm within 7 places
E @222, 38810913771.9 cm != 38810913771.9 cm within 7 places
E @223, 39063249952.1 cm != 39063249952.1 cm within 7 places
E @224, 39322130412.2 cm != 39322130412.2 cm within 7 places
E @225, 39831287501.2 cm != 39831287501.3 cm within 7 places
E @226, 40084849254.0 cm != 40084849254.0 cm within 7 places
E @227, 40337710763.2 cm != 40337710763.2 cm within 7 places
E @228, 40715616077.8 cm != 40715616077.8 cm within 7 places
E @229, 41091652858.5 cm != 41091652858.5 cm within 7 places
E @230, 41465624780.1 cm != 41465624780.1 cm within 7 places
E @231, 41960759429.6 cm != 41960759429.6 cm within 7 places
E @232, 42451307885.0 cm != 42451307885.0 cm within 7 places
E @233, 42691112244.0 cm != 42691112244.0 cm within 7 places
E @234, 42936533432.3 cm != 42936533432.3 cm within 7 places
E @235, 43416099782.5 cm != 43416099782.5 cm within 7 places
E @236, 43649939831.0 cm != 43649939831.0 cm within 7 places
E @237, 43888922989.3 cm != 43888922989.3 cm within 7 places
E @238, 44354539882.3 cm != 44354539882.3 cm within 7 places
E @239, 44811720599.0 cm != 44811720599.0 cm within 7 places
E @240, 45033314049.9 cm != 45033314049.9 cm within 7 places
E @241, 45258903352.6 cm != 45258903352.6 cm within 7 places
E @242, 45695249673.2 cm != 45695249673.2 cm within 7 places
E @243, 45906125400.8 cm != 45906125400.8 cm within 7 places
E @244, 46120669734.7 cm != 46120669734.7 cm within 7 places
E @245, 46535586423.9 cm != 46535586423.9 cm within 7 places
E @246, 46940184034.8 cm != 46940184034.8 cm within 7 places
E @247, 47135679354.6 cm != 47135679354.6 cm within 7 places
E @248, 47334652365.7 cm != 47334652365.7 cm within 7 places
E @249, 47719362409.3 cm != 47719362409.3 cm within 7 places
E @250, 47905223298.7 cm != 47905223298.7 cm within 7 places
E @251, 48094436746.2 cm != 48094436746.2 cm within 7 places
E @252, 48460211999.5 cm != 48460211999.5 cm within 7 places
../../../../../tests/amusetest.py:79: AssertionError
----------------------------- Captured stdout call -----------------------------
Test for importing new stellar models
_______________________________ TestMESA.test16 ________________________________
self = <test_mesa_2208.TestMESA testMethod=test16>
def test16(self):
print("Testing basic operations: evolve_one_step and evolve_for")
stars = Particles(2)
stars.mass = 1.0 | units.MSun
instance = self.new_instance_of_an_optional_code(MESA) # , redirection = 'none')
if instance is None:
print("MESA was not built. Skipping test.")
return
se_stars = instance.particles.add_particles(stars)
for i in range(3):
se_stars[0].evolve_one_step()
self.assertAlmostEqual(se_stars.age, [364000.0, 0] | units.yr)
se_stars[1].evolve_for(se_stars[0].age)
> self.assertAlmostRelativeEqual(se_stars[0].age, se_stars[1].age)
mesa_r2208/tests/test_mesa_2208.py:824:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../../tests/amusetest.py:140: in failUnlessAlmostRelativeEqual
self._raise_exceptions_if_any(failures, first, second, "{0!r} != {1!r} within {2!r} places", msg, places)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_mesa_2208.TestMESA testMethod=test16>
failures = array([ True], dtype=bool), first = quantity<364000.0 yr>
second = quantity<363992.225697 yr>
err_fmt_string = '{0!r} != {1!r} within {2!r} places', msg = None, args = (15,)
def _raise_exceptions_if_any(self, failures, first, second, err_fmt_string, msg, *args):
if len(failures) == 1:
if failures[0]:
> raise self.failureException(msg or err_fmt_string.format(first, second, *args))
E AssertionError: quantity<364000.0 yr> != quantity<363992.225697 yr> within 15 places
../../../../../tests/amusetest.py:73: AssertionError
----------------------------- Captured stdout call -----------------------------
Testing basic operations: evolve_one_step and evolve_for
________________________________ TestMESA.test2 ________________________________
self = <test_mesa_2208.TestMESA testMethod=test2>
def test2(self):
print("Testing basic operations: evolve and get_...")
instance = self.new_instance_of_an_optional_code(MESA)
if instance is None:
print("MESA was not built. Skipping test.")
return
instance.initialize_code()
instance.commit_parameters()
index_of_the_star = instance.new_particle(1.0 | units.MSun)
self.assertEqual(index_of_the_star, 1)
initial_dt = 1.0e5 | units.yr
dt_factor = 1.2
time_step = instance.get_time_step(index_of_the_star)
self.assertAlmostEqual(time_step, initial_dt)
instance.evolve_one_step(index_of_the_star)
age_of_the_star = instance.get_age(index_of_the_star)
self.assertAlmostEqual(age_of_the_star, initial_dt)
target_end_time = 3.0e5 | units.yr
instance.evolve_for(index_of_the_star, target_end_time - age_of_the_star)
> self.assertAlmostEqual(initial_dt*(1 + dt_factor + dt_factor**2), instance.get_age(index_of_the_star))
mesa_r2208/tests/test_mesa_2208.py:304:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../../tests/amusetest.py:108: in failUnlessAlmostEqual
self._raise_exceptions_if_any(failures, first, second, '{0} != {1} within {2} places', msg, places)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_mesa_2208.TestMESA testMethod=test2>
failures = array([ True], dtype=bool)
first = quantity<364000.0 31556925.993600003 * s>
second = quantity<299995.728405 yr>
err_fmt_string = '{0} != {1} within {2} places', msg = None, args = (7,)
def _raise_exceptions_if_any(self, failures, first, second, err_fmt_string, msg, *args):
if len(failures) == 1:
if failures[0]:
> raise self.failureException(msg or err_fmt_string.format(first, second, *args))
E AssertionError: 364000.0 31556925.993600003 * s != 299995.728405 yr within 7 places
../../../../../tests/amusetest.py:73: AssertionError
----------------------------- Captured stdout call -----------------------------
Testing basic operations: evolve and get_...
_______________________________ TestMESA.test22 ________________________________
self = <test_mesa_2208.TestMESA testMethod=test22>
def test22(self):
print("Testing MESA calculate_core_mass (short version of slowtest21)")
instance = self.new_instance_of_an_optional_code(MESA)
star = instance.particles.add_particle(Particle(mass=1 | units.MSun))
instance.evolve_model(0.3 | units.Gyr) # VERY short, for test speed up
central_hydrogen_abundance = star.get_chemical_abundance_profiles()[0][0]
self.assertTrue(central_hydrogen_abundance < 0.68) # some hydrogen is burned
self.assertTrue(central_hydrogen_abundance > 0.67) # ... but not that much yet
self.assertEqual(star.calculate_core_mass(core_H_abundance_limit=0.67), 0 | units.MSun)
self.assertAlmostEqual(star.calculate_core_mass(core_H_abundance_limit=0.70), 1 | units.MSun, 3)
# For test speed up, we use a weird core_H_abundance_limit to define the "hydrogen exhausted core"
limit = 0.68
expected_core_mass = 0.01786033709 | units.MSun
> self.assertAlmostEqual(star.calculate_core_mass(core_H_abundance_limit=limit), expected_core_mass, 3)
mesa_r2208/tests/test_mesa_2208.py:993:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../../tests/amusetest.py:108: in failUnlessAlmostEqual
self._raise_exceptions_if_any(failures, first, second, '{0} != {1} within {2} places', msg, places)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_mesa_2208.TestMESA testMethod=test22>
failures = array([ True], dtype=bool), first = quantity<0.00462594081992 MSun>
second = quantity<0.01786033709 MSun>
err_fmt_string = '{0} != {1} within {2} places', msg = None, args = (3,)
def _raise_exceptions_if_any(self, failures, first, second, err_fmt_string, msg, *args):
if len(failures) == 1:
if failures[0]:
> raise self.failureException(msg or err_fmt_string.format(first, second, *args))
E AssertionError: 0.00462594081992 MSun != 0.01786033709 MSun within 3 places
../../../../../tests/amusetest.py:73: AssertionError
----------------------------- Captured stdout call -----------------------------
Testing MESA calculate_core_mass (short version of slowtest21)
________________________________ TestMESA.test5 ________________________________
self = <test_mesa_2208.TestMESA testMethod=test5>
def test5(self):
print("Testing evolve_model for particle set...")
instance = self.new_instance_of_an_optional_code(MESA)
masses = [0.5, 1.0] | units.MSun
max_age = 0.6 | units.Myr
number_of_stars = len(masses)
stars = Particles(number_of_stars)
stars.mass = masses
instance.initialize_code()
self.assertEqual(instance.parameters.max_age_stop_condition, 1e30 | units.Myr)
instance.parameters.max_age_stop_condition = max_age
self.assertEqual(instance.parameters.max_age_stop_condition, max_age)
instance.particles.add_particles(stars)
instance.commit_particles()
from_code_to_model = instance.particles.new_channel_to(stars)
instance.evolve_model(end_time=0.5 | units.Myr)
from_code_to_model.copy()
# print stars
for i in range(number_of_stars):
> self.assertTrue(stars[i].age.value_in(units.Myr) >= 0.5)
E AssertionError: False is not true
mesa_r2208/tests/test_mesa_2208.py:424: AssertionError
----------------------------- Captured stdout call -----------------------------
Testing evolve_model for particle set...
=============================== warnings summary ===============================
../../../../../../../../../../../.miniconda3/envs/amuse-dev/lib/python3.12/site-packages/amuse/support/options.py:11
/home/lourens/.miniconda3/envs/amuse-dev/lib/python3.12/site-packages/amuse/support/options.py:11: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED mesa_r2208/tests/test_mesa_2208.py::TestMESAInterface::test4 - Asserti...
FAILED mesa_r2208/tests/test_mesa_2208.py::TestMESA::test11 - AssertionError:...
FAILED mesa_r2208/tests/test_mesa_2208.py::TestMESA::test12 - AssertionError:...
FAILED mesa_r2208/tests/test_mesa_2208.py::TestMESA::test16 - AssertionError:...
FAILED mesa_r2208/tests/test_mesa_2208.py::TestMESA::test2 - AssertionError: ...
FAILED mesa_r2208/tests/test_mesa_2208.py::TestMESA::test22 - AssertionError:...
FAILED mesa_r2208/tests/test_mesa_2208.py::TestMESA::test5 - AssertionError: ...
======== 7 failed, 19 passed, 1 skipped, 1 warning in 147.84s (0:02:27) ========
make: *** [Makefile:104: test-amuse-mesa_r2208] Error 1
make: Leaving directory '/home/lourens/NLeSC/projects/ReDiTSAp/software/amuse/src/amuse/community/mesa_r2208'
amuse-mesa_r2208 failed its tests.
This is not supposed to happen!
Please contact the developers on Slack or make an issue on GitHub,
so that we can fix this together.
The text was updated successfully, but these errors were encountered:
Describe the bug
MESA r2208 fails some of its tests, because #933 changed the timestepping logic but didn't update the tests. If I revert 5ee20a0 then they pass, so the code is not broken, just the tests.
To Reproduce
Once the new build system is merged:
src/amuse_mesa_r2208/tests/test_mesa_2208.py
./setup test mesa_r2208
make test-amuse-mesa_r2208
fromsrc/amuse_mesa_r2208
Expected behavior
The tests are expected to pass.
Logs
The text was updated successfully, but these errors were encountered: