From 6ebdb085c25f99d055d20b3dabcfe576ee7df4e1 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Wed, 13 Jul 2022 15:00:31 +0530 Subject: [PATCH 1/3] feat: test new version of 3.10 and 3.11 --- .github/workflows/lint.yml | 6 +++--- .github/workflows/pythonpackage.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bd77b461..ed732f7e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v3 with: - python-version: 3.9 + python-version: '3.10.5' cache: 'pip' - run: pip install --upgrade flake8 - name: flake8 @@ -33,7 +33,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v3 with: - python-version: 3.9 + python-version: '3.10.5' cache: 'pip' - run: python -m pip install isort - name: isort @@ -53,7 +53,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v3 with: - python-version: 3.9 + python-version: '3.10.5' cache: 'pip' - run: pip install --upgrade mypy types-requests types-urllib3 - name: mypy diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3d3d0dc5..86d46b75 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9, pypy-3.9, pypy-3.8, pypy-3.9, 3.10.4, '3.11.0-beta.3' ] + python-version: [3.7, 3.8, 3.9, pypy-3.9, pypy-3.8, pypy-3.9, '3.10.5', '3.11.0-beta.4' ] os: [ ubuntu-20.04, windows-2022, From 7e6b769a6f26fd5349eece76cad48f8b6660f8dc Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Fri, 15 Jul 2022 22:09:28 +0530 Subject: [PATCH 2/3] fix: use pytest.raises instread of self.assertRaises Watch this video by Anthony Sottile. https://youtu.be/Q_HMOBD09ts Authored-by: Vinit Kumar Signed-off-by: Vinit Kumar --- tests/test_json2xml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_json2xml.py b/tests/test_json2xml.py index c1045fbb..61c20dc4 100644 --- a/tests/test_json2xml.py +++ b/tests/test_json2xml.py @@ -4,6 +4,7 @@ import unittest +import pytest from collections import OrderedDict from pyexpat import ExpatError @@ -88,7 +89,7 @@ def test_no_wrapper(self): ) xmldata = json2xml.Json2xml(data, root=False, pretty=False).to_xml() assert xmldata.startswith(b'mojombo') - self.assertRaises(ExpatError, xmltodict.parse, xmldata) + pytest.raises(ExpatError, xmltodict.parse, xmldata) def test_item_wrap(self): data = readfromstring( From 0e82767530ee774ef4a3aabebb3503aa767abe66 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Fri, 15 Jul 2022 22:13:27 +0530 Subject: [PATCH 3/3] fix: ci --- tests/test_dict2xml.py | 1 + tests/test_json2xml.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_dict2xml.py b/tests/test_dict2xml.py index 6aee83e0..c3b4fed3 100644 --- a/tests/test_dict2xml.py +++ b/tests/test_dict2xml.py @@ -1,4 +1,5 @@ import unittest + from json2xml import dicttoxml diff --git a/tests/test_json2xml.py b/tests/test_json2xml.py index 61c20dc4..beaab636 100644 --- a/tests/test_json2xml.py +++ b/tests/test_json2xml.py @@ -3,18 +3,18 @@ """Tests for `json2xml` package.""" +import json import unittest -import pytest from collections import OrderedDict -from pyexpat import ExpatError import pytest import xmltodict -import json +from pyexpat import ExpatError from json2xml import json2xml -from json2xml.utils import InvalidDataError, readfromjson, readfromstring, readfromurl, \ - JSONReadError, StringReadError, URLReadError +from json2xml.utils import (InvalidDataError, JSONReadError, StringReadError, + URLReadError, readfromjson, readfromstring, + readfromurl) class TestJson2xml(unittest.TestCase):