diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..68f84b7 --- /dev/null +++ b/.github/workflows/tests.yml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8d84153..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: python - -sudo: false - -python: - - "2.7" - - "3.5" - - "3.6" - - "3.7" - - "3.8" - - "nightly" - - "pypy" - - "pypy3" - -env: - - PYYAML_VERSION="3.13" - # - PYYAML_VERSION="4.1" # this was pulled from the index (!) ..wtf, Ingy? - - PYYAML_VERSION="4.2b4" - - PYYAML_VERSION="5.3" - -matrix: - fast_finish: true - allow_failures: - - python: "nightly" - -install: - - pip install pyyaml~=$PYYAML_VERSION - - pip install --editable . - - pip install pytest-cov coveralls - -script: - - pip freeze - - pytest --cov=oyaml - -after_success: - - coverage combine - - coveralls - -notifications: - email: false diff --git a/README.rst b/README.rst index 83c0a6a..f45806f 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/setup.cfg b/setup.cfg index ed8a958..0c9e0fc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,2 @@ -[bdist_wheel] -universal = 1 - [metadata] license_file = LICENSE diff --git a/setup.py b/setup.py index 07dcb63..a26a228 100644 --- a/setup.py +++ b/setup.py @@ -11,4 +11,5 @@ license="MIT", py_modules=["oyaml"], install_requires=["pyyaml"], + options={"bdist_wheel": {"universal": True}}, ) diff --git a/test_oyaml.py b/test_oyaml.py index 8058c22..e4bdc87 100644 --- a/test_oyaml.py +++ b/test_oyaml.py @@ -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} @@ -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 == {} @@ -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) @@ -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(): @@ -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(): @@ -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}