third_party_pyyaml/packaging/build/smoketest.py
Brad Solomon 89f608599d Build modernization (GHA, wheels, setuptools) (#407)
* Move most CI to GitHub Actions
* Build sdist
* Build manylinux1 wheels with libyaml ext (also tested with 2010 and 2014)
* Build MacOS x86_64 wheels with libyaml ext
* Windows wheel builds remain on AppVeyor until we drop 2.7 support in 6.0
* Smoke tests of all post-build artifacts
* Add PEP517/518 build declaration (pyproject.toml with setuptools backend)
* Fully move build to setuptools
* Drop Python 3.5 support
* Declare Python 3.9 support
* Update PyPI metadata now that setuptools lets it flow through

Co-authored-by: Matt Davis <mrd@redhat.com>
2021-01-13 16:58:40 -05:00

22 lines
744 B
Python

import sys
import yaml
def main():
# various smoke tests on an installed PyYAML with extension
if not getattr(yaml, '_yaml', None):
raise Exception('C extension is not available at `yaml._yaml`')
print('embedded libyaml version is {0}'.format(yaml._yaml.get_version_string()))
for loader, dumper in [(yaml.CLoader, yaml.CDumper), (yaml.Loader, yaml.Dumper)]:
testyaml = 'dude: mar'
loaded = yaml.load(testyaml, Loader=loader)
dumped = yaml.dump(loaded, Dumper=dumper)
if testyaml != dumped.strip():
raise Exception('roundtrip failed with {0}/{1}'.format(loader, dumper))
print('smoke test passed for {0}'.format(sys.executable))
if __name__ == '__main__':
main()