Fix RuntimeWarning: You have iterated over the result of

pkg_resources.parse_version. This is a legacy behavior

Fix #504
This commit is contained in:
Julien Duponchelle committed 2016-05-02 17:14:15 +02:00
1 parent 978ec1b5be
commit d952718f30
12 files changed
+56 -11

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ import os
import sys
from tests.utils import asyncio_patch
from pkg_resources import parse_version
from gns3server.utils import parse_version
from unittest.mock import patch, MagicMock
from gns3server.modules.vpcs.vpcs_vm import VPCSVM
+16 -1
View File
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gns3server.utils import force_unix_path, macaddress_to_int, int_to_macaddress
from gns3server.utils import *
def test_force_unix_path():
@@ -31,3 +31,18 @@ def test_macaddress_to_int():
def test_int_to_macaddress():
assert int_to_macaddress(52228632586) == "00:0c:29:11:b0:0a"
def test_parse_version():
assert parse_version('1') == (1, 'final')
assert parse_version('1.3') == (1, 3, 'final')
assert parse_version('1.3.dev3') == (1, 3, 'dev', 3)
assert parse_version('1.3a1') == (1, 3, 'a', 1)
assert parse_version('1.3rc1') == (1, 3, 'c', 1)
assert parse_version('1.2.3') > parse_version('1.2.2')
assert parse_version('1.3') > parse_version('1.2.2')
assert parse_version('1.3') > parse_version('1.3alpha1')
assert parse_version('1.3') > parse_version('1.3rc1')
assert parse_version('1.3rc1') > parse_version('1.3alpha3')
assert parse_version('1.3dev1') > parse_version('1.3rc1')