Skip to content

Commit d019507

Browse files
authored
Merge pull request #24 from wimglenn/pyyaml-6
6
2 parents 45bef7e + 7381373 commit d019507

File tree

6 files changed

+53
-56
lines changed

6 files changed

+53
-56
lines changed

.github/workflows/tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: tests
2+
3+
on:
4+
pull_request:
5+
branches: ["master"]
6+
7+
jobs:
8+
tests:
9+
name: "py${{ matrix.python-version }} / ${{ matrix.os }} / PyYAML~=${{ matrix.pyyaml-version }}"
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
python-version: ["2.7", "3.6"]
16+
pyyaml-version: ["3.13", "4.2b4", "5.4"]
17+
include:
18+
- { os: ubuntu-latest, python-version: "3.10", pyyaml-version: "6.0" }
19+
- { os: macos-latest, python-version: "3.10", pyyaml-version: "6.0" }
20+
- { os: windows-latest, python-version: "3.10", pyyaml-version: "6.0" }
21+
22+
steps:
23+
- uses: "actions/checkout@v2"
24+
- uses: "actions/setup-python@v2"
25+
with:
26+
python-version: "${{ matrix.python-version }}"
27+
architecture: x64
28+
- name: "Install"
29+
run: |
30+
python -VV
31+
python -m pip install -q pytest pytest-cov pyyaml~=${{ matrix.pyyaml-version }} -e .
32+
python -m pip freeze --all
33+
- name: "Run tests py${{ matrix.python-version }} / ${{ matrix.os }} / PyYAML~=${{ matrix.pyyaml-version }}"
34+
run: python -m pytest --cov-branch --cov=oyaml
35+
36+
- name: Upload coverage to Codecov
37+
uses: "codecov/codecov-action@v1"
38+
with:
39+
fail_ci_if_error: true

.travis.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
|travis|_ |coveralls|_ |pypi|_ |womm|_
1+
|actions|_ |codecov|_ |pypi|_ |womm|_
22

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

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

99
.. |pypi| image:: https://img.shields.io/pypi/v/oyaml.svg
1010
.. _pypi: https://pypi.org/project/oyaml

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
[bdist_wheel]
2-
universal = 1
3-
41
[metadata]
52
license_file = LICENSE

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
license="MIT",
1212
py_modules=["oyaml"],
1313
install_requires=["pyyaml"],
14+
options={"bdist_wheel": {"universal": True}},
1415
)

test_oyaml.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_safe_dump_all():
4141

4242

4343
def test_load():
44-
loaded = yaml.load("{x: 1, z: 3, y: 2}")
44+
loaded = yaml.safe_load("{x: 1, z: 3, y: 2}")
4545
assert loaded == {"x": 1, "z": 3, "y": 2}
4646

4747

@@ -51,7 +51,7 @@ def test_safe_load():
5151

5252

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

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

6666

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

@@ -118,7 +118,7 @@ def test_anchors_and_references():
118118
"platform": {"host": "baz", "product": "foo", "profile": "bar"}
119119
},
120120
}
121-
assert yaml.load(text) == expected_load
121+
assert yaml.safe_load(text) == expected_load
122122

123123

124124
def test_omap():
@@ -137,13 +137,13 @@ def test_omap():
137137
]
138138
)
139139
}
140-
assert yaml.load(text) == expected_load
140+
assert yaml.safe_load(text) == expected_load
141141

142142

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

148148

149149
def test_merge():
@@ -175,7 +175,7 @@ def test_merge():
175175
x: 1
176176
label: center/big
177177
"""
178-
data = yaml.load(text)
178+
data = yaml.safe_load(text)
179179
assert len(data) == 8
180180
center, left, big, small, map1, map2, map3, map4 = data
181181
assert center == {"x": 1, "y": 2}

0 commit comments

Comments
 (0)