Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code #56

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions radl/radl.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import copy
import re
from distutils.version import LooseVersion
from packaging.version import Version

try:
unicode
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
3 changes: 0 additions & 3 deletions test/TestRADL.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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")
Expand Down