Skip to content

Commit

Permalink
Circumvent Travis CI not finding ruamel.yaml on osx
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Aug 15, 2019
1 parent e24805d commit 8302778
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions interfaces/cython/cantera/test/test_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import numpy as np
from .utilities import unittest
from ruamel.yaml import YAML

import cantera as ct
from . import utilities
Expand Down Expand Up @@ -405,24 +404,28 @@ def test_yaml(self, **kwargs):
self.assertTrue(isinstance(reservoir.to_yaml(), str))
self.assertTrue(isinstance(mfc.to_yaml(), str))

yaml = YAML()
yml = yaml.load(self.net.to_yaml())
self.assertTrue('ReactorNet' in yml)
net = yml['ReactorNet']
try:
# travis build fails on osx (ModuleNotFoundError)
from ruamel.yaml import YAML

self.assertTrue('ReactorBase' in net)
reactors = [tuple(n)[0] for n in net['ReactorBase']]
self.assertTrue(self.r1.name in reactors)
self.assertTrue(self.r2.name in reactors)
self.assertTrue(reservoir.name in reactors)
yaml = YAML()
yml = yaml.load(self.net.to_yaml())
self.assertTrue('ReactorNet' in yml)
net = yml['ReactorNet']

self.assertTrue('WallBase' in net)
walls = [tuple(n)[0] for n in net['WallBase']]
self.assertTrue(self.w.name in walls)
self.assertTrue('ReactorBase' in net)
reactors = [tuple(n)[0] for n in net['ReactorBase']]
self.assertTrue(self.r1.name in reactors)
self.assertTrue(self.r2.name in reactors)
self.assertTrue(reservoir.name in reactors)

self.assertTrue('FlowDevice' in net)
devices = [tuple(n)[0] for n in net['FlowDevice']]
self.assertTrue(mfc.name in devices)
self.assertTrue('WallBase' in net)
walls = [tuple(n)[0] for n in net['WallBase']]
self.assertTrue(self.w.name in walls)

self.assertTrue('FlowDevice' in net)
devices = [tuple(n)[0] for n in net['FlowDevice']]
self.assertTrue(mfc.name in devices)

self.r2.name = self.r1.name
with self.assertRaisesRegex(ct.CanteraError, 'names are not unique'):
Expand Down

0 comments on commit 8302778

Please sign in to comment.