Skip to content

Commit

Permalink
Merge pull request #24 from wimglenn/pyyaml-6
Browse files Browse the repository at this point in the history
6
  • Loading branch information
wimglenn authored Dec 3, 2021
2 parents 45bef7e + 7381373 commit d019507
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 56 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: tests

on:
pull_request:
branches: ["master"]

jobs:
tests:
name: "py${{ matrix.python-version }} / ${{ matrix.os }} / PyYAML~=${{ matrix.pyyaml-version }}"
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["2.7", "3.6"]
pyyaml-version: ["3.13", "4.2b4", "5.4"]
include:
- { os: ubuntu-latest, python-version: "3.10", pyyaml-version: "6.0" }
- { os: macos-latest, python-version: "3.10", pyyaml-version: "6.0" }
- { os: windows-latest, python-version: "3.10", pyyaml-version: "6.0" }

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
architecture: x64
- name: "Install"
run: |
python -VV
python -m pip install -q pytest pytest-cov pyyaml~=${{ matrix.pyyaml-version }} -e .
python -m pip freeze --all
- name: "Run tests py${{ matrix.python-version }} / ${{ matrix.os }} / PyYAML~=${{ matrix.pyyaml-version }}"
run: python -m pytest --cov-branch --cov=oyaml

- name: Upload coverage to Codecov
uses: "codecov/codecov-action@v1"
with:
fail_ci_if_error: true
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
|travis|_ |coveralls|_ |pypi|_ |womm|_
|actions|_ |codecov|_ |pypi|_ |womm|_

.. |travis| image:: https://img.shields.io/travis/wimglenn/oyaml.svg?branch=master
.. _travis: https://travis-ci.org/wimglenn/oyaml
.. |actions| image:: https://github.com/wimglenn/oyaml/actions/workflows/tests.yml/badge.svg
.. _actions: https://github.com/wimglenn/oyaml/actions/workflows/tests.yml

.. |coveralls| image:: https://img.shields.io/coveralls/wimglenn/oyaml.svg
.. _coveralls: https://coveralls.io/github/wimglenn/oyaml?branch=master
.. |codecov| image:: https://codecov.io/gh/wimglenn/oyaml/branch/master/graph/badge.svg
.. _codecov: https://codecov.io/gh/wimglenn/oyaml

.. |pypi| image:: https://img.shields.io/pypi/v/oyaml.svg
.. _pypi: https://pypi.org/project/oyaml
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
[bdist_wheel]
universal = 1

[metadata]
license_file = LICENSE
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
license="MIT",
py_modules=["oyaml"],
install_requires=["pyyaml"],
options={"bdist_wheel": {"universal": True}},
)
16 changes: 8 additions & 8 deletions test_oyaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_safe_dump_all():


def test_load():
loaded = yaml.load("{x: 1, z: 3, y: 2}")
loaded = yaml.safe_load("{x: 1, z: 3, y: 2}")
assert loaded == {"x": 1, "z": 3, "y": 2}


Expand All @@ -51,7 +51,7 @@ def test_safe_load():


def test_load_all():
gen = yaml.load_all("{x: 1, z: 3, y: 2}\n--- {}\n")
gen = yaml.safe_load_all("{x: 1, z: 3, y: 2}\n--- {}\n")
assert isinstance(gen, GeneratorType)
ordered_data, empty_dict = gen
assert empty_dict == {}
Expand All @@ -60,13 +60,13 @@ def test_load_all():

@pytest.mark.skipif(_std_dict_is_order_preserving, reason="requires old dict impl")
def test_loads_to_ordered_dict():
loaded = yaml.load("{x: 1, z: 3, y: 2}")
loaded = yaml.safe_load("{x: 1, z: 3, y: 2}")
assert isinstance(loaded, OrderedDict)


@pytest.mark.skipif(not _std_dict_is_order_preserving, reason="requires new dict impl")
def test_loads_to_std_dict():
loaded = yaml.load("{x: 1, z: 3, y: 2}")
loaded = yaml.safe_load("{x: 1, z: 3, y: 2}")
assert not isinstance(loaded, OrderedDict)
assert isinstance(loaded, dict)

Expand Down Expand Up @@ -118,7 +118,7 @@ def test_anchors_and_references():
"platform": {"host": "baz", "product": "foo", "profile": "bar"}
},
}
assert yaml.load(text) == expected_load
assert yaml.safe_load(text) == expected_load


def test_omap():
Expand All @@ -137,13 +137,13 @@ def test_omap():
]
)
}
assert yaml.load(text) == expected_load
assert yaml.safe_load(text) == expected_load


def test_omap_flow_style():
text = "Numbers: !!omap [ one: 1, two: 2, three : 3 ]"
expected_load = {"Numbers": ([("one", 1), ("two", 2), ("three", 3)])}
assert yaml.load(text) == expected_load
assert yaml.safe_load(text) == expected_load


def test_merge():
Expand Down Expand Up @@ -175,7 +175,7 @@ def test_merge():
x: 1
label: center/big
"""
data = yaml.load(text)
data = yaml.safe_load(text)
assert len(data) == 8
center, left, big, small, map1, map2, map3, map4 = data
assert center == {"x": 1, "y": 2}
Expand Down

0 comments on commit d019507

Please sign in to comment.