-
-
Notifications
You must be signed in to change notification settings - Fork 409
Closed
Labels
Description
Problem description
After throwing DeprecationWarnings for a while, yaml.safe_load finally broke.
Steps to reproduce
Run GitHub Actions on a PR.
Behavior
The old deprecation warning was:
build/python/cantera/test/test_composite.py::TestSolutionSerialization::test_yaml_outunits
/home/runner/work/cantera/cantera/build/python/cantera/test/test_composite.py:579: PendingDeprecationWarning:
safe_load will be removed, use
yaml=YAML(typ='safe', pure=True)
yaml.load(...)
instead
generated = yaml.safe_load(infile)
The error now is:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ruamel.yaml.loader.SafeLoader object at 0x7f536a988208>, block = True
indentless_sequence = True
def parse_node(self, block=False, indentless_sequence=False):
# type: (bool, bool) -> Any
if self.scanner.check_token(AliasToken):
token = self.scanner.get_token()
event = AliasEvent(token.value, token.start_mark, token.end_mark) # type: Any
self.state = self.states.pop()
return event
anchor = None
tag = None
start_mark = end_mark = tag_mark = None
if self.scanner.check_token(AnchorToken):
token = self.scanner.get_token()
self.move_token_comment(token)
start_mark = token.start_mark
end_mark = token.end_mark
anchor = token.value
if self.scanner.check_token(TagToken):
token = self.scanner.get_token()
tag_mark = token.start_mark
end_mark = token.end_mark
tag = token.value
elif self.scanner.check_token(TagToken):
token = self.scanner.get_token()
start_mark = tag_mark = token.start_mark
end_mark = token.end_mark
tag = token.value
if self.scanner.check_token(AnchorToken):
token = self.scanner.get_token()
start_mark = tag_mark = token.start_mark
end_mark = token.end_mark
anchor = token.value
if tag is not None:
handle, suffix = tag
if handle is not None:
if handle not in self.tag_handles:
raise ParserError(
'while parsing a node',
start_mark,
_F('found undefined tag handle {handle!r}', handle=handle),
tag_mark,
)
tag = self.transform_tag(handle, suffix)
else:
tag = suffix
# if tag == '!':
# raise ParserError("while parsing a node", start_mark,
# "found non-specific tag '!'", tag_mark,
# "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag'
# and share your opinion.")
if start_mark is None:
start_mark = end_mark = self.scanner.peek_token().start_mark
event = None
implicit = tag is None or tag == '!'
if indentless_sequence and self.scanner.check_token(BlockEntryToken):
comment = None
pt = self.scanner.peek_token()
> if self.loader and self.loader.comment_handling is None:
E AttributeError: 'SafeLoader' object has no attribute 'comment_handling'
/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/site-packages/ruamel/yaml/parser.py:414: AttributeError
___________ ERROR at setup of TestModels.test_restore_thermo_models ____________
cls = <class 'cantera.test.test_composite.TestModels'>
@classmethod
def setUpClass(cls):
utilities.CanteraTest.setUpClass()
cls.yml_file = pjoin(cls.test_data_dir, "thermo-models.yaml")
with open(cls.yml_file, 'rt', encoding="utf-8") as stream:
> cls.yml = yaml.safe_load(stream)
../../build/python/cantera/test/test_composite.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/site-packages/ruamel/yaml/main.py:1118: in safe_load
return load(stream, SafeLoader, version)
/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/site-packages/ruamel/yaml/main.py:1071: in load
return loader._constructor.get_single_data()
System information
- Cantera version:
main - OS: GH Actions
Affected Tests
*****************************
*** Testing Summary ***
scons: building terminated because of errors.
*****************************
Tests passed: 1439
Up-to-date tests skipped: 0
Tests failed: 3
Failed tests:
- python: test_composite.TestSolutionSerialization.test_yaml_outunits
- python: test_convert.ck2yamlTest.test_extra
- python: test_convert.ck2yamlTest.test_sri_zero
*****************************
Reactions are currently unavailable