Skip to content

Very Mysterious Unit Test Failure in ReactorTest.Py #2872

@sevyharris

Description

@sevyharris

Bug Description

The Continuous Integration tests started failing last night.
https://github.com/ReactionMechanismGenerator/RMG-Py/actions/runs/21060625788/job/60565859664

For some reason, the Cantera reaction object (made using the .from_yaml call) is slightly altering the rate constant:

FAILED reactionTest.py::TestReactionToCantera::test_arrhenius - AssertionError: assert {'rate-constant': {'A': 660000.0, 'b': 1.62, 'Ea': 45354560.0}} == {'rate-constant': {'A': 660000.0000000001, 'b': 1.62, 'Ea': 45354560.0}}

  Differing items:
  {'rate-constant': {'A': 660000.0, 'Ea': 45354560.0, 'b': 1.62}} != {'rate-constant': {'A': 660000.0000000001, 'Ea': 45354560.0, 'b': 1.62}}

  Full diff:
    {
        'rate-constant': {
  -         'A': 660000.0000000001,
  ?                      ---------
  +         'A': 660000.0,
            'Ea': 45354560.0,
            'b': 1.62,
        },
    }
FAILED reactionTest.py::TestReactionToCantera::test_multi_arrhenius - assert 0.001 == 0
 +  where 0.001 = round(0.0009765625, 3)
 +    where 0.0009765625 = abs((5000000000000.0 - 5000000000000.001))
 +      where 5000000000000.0 = <ArrheniusRate at 7f9185b7c7b0>.pre_exponential_factor
 +        where <ArrheniusRate at 7f9185b7c7b0> = HO2(5) + OH(4) <=> H2O(27) + O2(6)    <Reaction(Arrhenius)>.rate
 +      and   5000000000000.001 = <ArrheniusRate at 7f9185b7cd70>.pre_exponential_factor
 +        where <ArrheniusRate at 7f9185b7cd70> = HO2(5) + OH(4) <=> H2O(27) + O2(6)    <Reaction(Arrhenius)>.rate
FAILED reactionTest.py::TestChargeTransferReaction::test_get_rate_coeff - assert 0.0078125 < 1e-06
 +  where 0.0078125 = abs((43870506959778.99 - 43870506959779.0))
=========================================================== 3 failed, 55 passed, 2 skipped, 7 warnings in 9.43s ============================================================

What's strange is that I can't for the life of me see why the test started failing now. The last PR passed these tests and didn't mess with any of the testing, cantera, or conda environment code.

How To Reproduce

Run pytest reactionTest.py in the RMG-Py/test/rmgpy directory on the main branch with the latest version of RMG.

Expected Behavior

CI unit tests should be passing so we can easily evaluate new code suggestions.

One other mysterious aspect of this is that I tried rolling back the version on the main branch by 20+ commits and it still fails. 4a6e9fc is what I tried. I would expect that if the problem existed back in July, CI would've caught it by now.

My hunch is that it has something to do with conda environments changing how ct.Reaction.from_yaml() gets executed. There's some conversion on the Cantera side that's multiplying the reaction rate by something that mangles some bits of the float.

Installation Information

Describe your installation method and system information.

Additional Context

I have a medium-out-of-date branch on the Northeastern Explorer cluster where this test passes: https://github.com/sevyharris/RMG-Py/tree/autoscience_uncertainties_2025

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions