Skip to content

Commit

Permalink
Use packaging.version (#125)
Browse files Browse the repository at this point in the history
* Use packaging.version, distutils.version is deprecated

* Use packaging.version, distutils.version is deprecated
  • Loading branch information
myakove authored Apr 7, 2022
1 parent 6166125 commit b1b7b93
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pytest_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os
import re
import sys
from distutils.version import LooseVersion
from packaging.version import Version
from json import JSONDecodeError

import pytest
Expand Down Expand Up @@ -91,7 +91,7 @@ def is_issue_resolved(self, issue_id):
return not self.is_affected(issue_id)

def get_marker(self, item):
if LooseVersion(pytest.__version__) >= LooseVersion("3.6.0"):
if Version(pytest.__version__) >= Version("3.6.0"):
return item.get_closest_marker("jira")
else:
return item.keywords.get("jira")
Expand Down Expand Up @@ -276,7 +276,7 @@ def __init__(self, strategy, docs, pattern):

def _get_marks(self, item):
marks = []
if LooseVersion(pytest.__version__) >= LooseVersion("3.6.0"):
if Version(pytest.__version__) >= Version("3.6.0"):
for mark in item.iter_markers("jira"):
marks.append(mark)
else:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ six
requests>=2.13.0
retry>=0.9.2
marshmallow>=3.2.0
packaging
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
flake8
coverage
packaging
6 changes: 3 additions & 3 deletions tests/test_jira.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from distutils.version import LooseVersion
from packaging.version import Version

import pytest

Expand Down Expand Up @@ -916,7 +916,7 @@ def test_pass():


@pytest.mark.skipif(
LooseVersion(pytest.__version__) < LooseVersion("3.0.0"),
Version(pytest.__version__) < Version("3.0.0"),
reason="requires pytest-3 or higher")
def test_jira_marker_with_parametrize_pytest3(testdir):
""""""
Expand All @@ -936,7 +936,7 @@ def test_fail(arg):


@pytest.mark.skipif(
LooseVersion(pytest.__version__) >= LooseVersion("3.0.0"),
Version(pytest.__version__) >= Version("3.0.0"),
reason="requires pytest-2 or lower")
def test_jira_marker_with_parametrize_pytest2(testdir):
""""""
Expand Down

0 comments on commit b1b7b93

Please sign in to comment.