diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 7c7509a..809f742 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -19,13 +19,13 @@ jobs: python-version: '3.10' - name: Install dependencies - run: python -m pip install pycodestyle ply coverage + run: python -m pip install pycodestyle ply coverage packaging - name: Check code style run: pycodestyle --max-line-length=120 --ignore=E402,W504,W605,E722,E741 . --exclude=doc - name: Unit tests - run: python -m coverage run --source=. -m unittest discover -s test -p '*.py' + run: python -m coverage run --source=. -m unittest discover -v -s test -p '*.py' - name: Generate XML coverage report run: python -m coverage xml diff --git a/radl/radl.py b/radl/radl.py index 77b7c94..c0282cd 100644 --- a/radl/radl.py +++ b/radl/radl.py @@ -16,7 +16,7 @@ import copy import re -from distutils.version import LooseVersion +from packaging.version import Version try: unicode @@ -797,7 +797,7 @@ def isNewerThan(self, other): if not other.getValue("version"): return False else: - return LooseVersion(self.getValue("version")) > LooseVersion(other.getValue("version")) + return Version(self.getValue("version")) > Version(other.getValue("version")) else: return True else: diff --git a/setup.py b/setup.py index 230357d..44918de 100644 --- a/setup.py +++ b/setup.py @@ -31,4 +31,4 @@ "Python 2 and Python 3"), description="Resource and Application Description Language (RADL) parser.", platforms=["any"], - install_requires=["ply"]) + install_requires=["ply", "packaging"]) diff --git a/test/TestRADL.py b/test/TestRADL.py index c4c6e83..7d866d9 100644 --- a/test/TestRADL.py +++ b/test/TestRADL.py @@ -387,7 +387,6 @@ def test_contextualize_options(self): self.assertEqual(r.contextualize.options['ansible_version'].getLogOperator(), '<=') radl_json = dump_radl_json(r) - print(radl_json) r = parse_radl_json(radl_json) r.check() self.assertEqual(len(r.contextualize.options), 1) @@ -408,7 +407,6 @@ def test_empty_configure(self): self.assertEqual(r.configures[0].recipes, None) radl_json = dump_radl_json(r) - print(radl_json) r = parse_radl_json(radl_json) r.check() self.assertEqual(r.configures[0].recipes, None) @@ -424,7 +422,6 @@ def test_escape_quote(self): self.assertEqual(r.systems[0].getValue("some_value"), "some ' some") radl_json = dump_radl_json(r) - print(radl_json) r = parse_radl_json(radl_json) r.check() self.assertEqual(r.systems[0].getValue("some_value"), "some ' some")