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
I ran pytest testsuite on the master branch and was surprised to see some tests fail. This turned out to be because I was running on a new macOS laptop without LibYAML installed. There seem to be small differences in the error messages between pure-Python YAML and LibYAML. For example,while parsing a flow mapping gives expected ',' or '}', but got '<scalar>' in pure-Python YAML but did not find expected ',' or '}' with LibYAML. The tests assume the latter. Maybe the tests could be modified to work with both pure-Python YAML and LibYAML so that developers don't need to install LibYAML.
Installing PyYAML with LibYAML enabled also turned out to be non-trivial on macOS, so it could be documented in the installation instructions. After installing LibYAML using Homebrew with brew install libyaml, PyYAML needs to be built by linking with the LibYAML C bindings:
Another minor issue with the installation instructions is that in zsh the command pip install --upgrade -e .[tests] needs additional quote marks: pip install --upgrade -e ".[tests]".
The text was updated successfully, but these errors were encountered:
I guess what's needed is to run the tests using yaml.SafeLoader and yaml.SafeDumper, then run the tests again if yaml.CSafeLoader and yaml.CSafeDumper can be imported. This would avoid the need to test with different operating systems in the CI. It looks like PyYAML is already built with LibYAML for macOS in the CI. We could then remove # pragma: no cover from the lines importing yaml.SafeLoader and yaml.SafeDumper.
Surprised at how hard it is to install pyyaml without libyaml - I can't get it working locally! I'll do as you suggest, using an environment variable to allow disabling of libyaml in __init__.py
I ran
pytest testsuite
on themaster
branch and was surprised to see some tests fail. This turned out to be because I was running on a new macOS laptop without LibYAML installed. There seem to be small differences in the error messages between pure-Python YAML and LibYAML. For example,while parsing a flow mapping
givesexpected ',' or '}', but got '<scalar>'
in pure-Python YAML butdid not find expected ',' or '}'
with LibYAML. The tests assume the latter. Maybe the tests could be modified to work with both pure-Python YAML and LibYAML so that developers don't need to install LibYAML.Installing PyYAML with LibYAML enabled also turned out to be non-trivial on macOS, so it could be documented in the installation instructions. After installing LibYAML using Homebrew with
brew install libyaml
, PyYAML needs to be built by linking with the LibYAML C bindings:Another minor issue with the installation instructions is that in
zsh
the commandpip install --upgrade -e .[tests]
needs additional quote marks:pip install --upgrade -e ".[tests]"
.The text was updated successfully, but these errors were encountered: