Skip to content

Commit

Permalink
[vstest]: change from platform to distro
Browse files Browse the repository at this point in the history
platform.linux_distribution is no longer supported 3.8+

Signed-off-by: Guohan Lu <[email protected]>
  • Loading branch information
lguohan committed Jul 7, 2020
1 parent d7ff1ad commit c7c63ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/test_mirror.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This test suite covers the functionality of mirror feature in SwSS
import platform
import distro
import pytest
import time

Expand Down Expand Up @@ -235,7 +235,7 @@ def remove_fdb(self, vlan, mac):

# Ignore testcase in Debian Jessie
# TODO: Remove this skip if Jessie support is no longer needed
@pytest.mark.skipif(StrictVersion(platform.linux_distribution()[1]) <= StrictVersion('8.9'), reason="Debian 8.9 or before has no support")
@pytest.mark.skipif(StrictVersion(distro.linux_distribution()[1]) <= StrictVersion('8.9'), reason="Debian 8.9 or before has no support")
def test_MirrorToVlanAddRemove(self, dvs, testlog):
"""
This test covers basic mirror session creation and removal operation
Expand Down Expand Up @@ -442,7 +442,7 @@ def test_MirrorToLagAddRemove(self, dvs, testlog):

# Ignore testcase in Debian Jessie
# TODO: Remove this skip if Jessie support is no longer needed
@pytest.mark.skipif(StrictVersion(platform.linux_distribution()[1]) <= StrictVersion('8.9'), reason="Debian 8.9 or before has no support")
@pytest.mark.skipif(StrictVersion(distro.linux_distribution()[1]) <= StrictVersion('8.9'), reason="Debian 8.9 or before has no support")
def test_MirrorDestMoveVlan(self, dvs, testlog):
"""
This test tests mirror session destination move from non-VLAN to VLAN
Expand Down
10 changes: 5 additions & 5 deletions tests/test_vlan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import platform
import distro
import pytest

from distutils.version import StrictVersion
Expand Down Expand Up @@ -158,7 +158,7 @@ def test_VlanIncrementalConfig(self, dvs):
self.dvs_vlan.remove_vlan(vlan)
self.dvs_vlan.get_and_verify_vlan_ids(0)

@pytest.mark.skipif(StrictVersion(platform.linux_distribution()[1]) <= StrictVersion('8.9'),
@pytest.mark.skipif(StrictVersion(distro.linux_distribution()[1]) <= StrictVersion('8.9'),
reason="Debian 8.9 or before has no support")
@pytest.mark.parametrize("test_input, expected", [
(["Vla", "2"], 0),
Expand All @@ -185,7 +185,7 @@ def test_AddVlanWithIncorrectKeyPrefix(self, dvs, test_input, expected):
self.dvs_vlan.remove_vlan(vlan_id)
self.dvs_vlan.get_and_verify_vlan_ids(0)

@pytest.mark.skipif(StrictVersion(platform.linux_distribution()[1]) <= StrictVersion('8.9'),
@pytest.mark.skipif(StrictVersion(distro.linux_distribution()[1]) <= StrictVersion('8.9'),
reason="Debian 8.9 or before has no support")
@pytest.mark.parametrize("test_input, expected", [
(["Vlan", "abc"], 0),
Expand Down Expand Up @@ -277,7 +277,7 @@ def test_RemoveNonexistentVlan(self, dvs):
self.dvs_vlan.remove_vlan(vlan)
self.dvs_vlan.get_and_verify_vlan_ids(0)

@pytest.mark.skipif(StrictVersion(platform.linux_distribution()[1]) <= StrictVersion('8.9'),
@pytest.mark.skipif(StrictVersion(distro.linux_distribution()[1]) <= StrictVersion('8.9'),
reason="Debian 8.9 or before has no support")
@pytest.mark.parametrize("test_input, expected", [
(["tagging_mode", "untagged"], [1, "SAI_VLAN_TAGGING_MODE_UNTAGGED"]),
Expand Down Expand Up @@ -385,7 +385,7 @@ def test_VlanDbData(self, dvs):

self.dvs_vlan.remove_vlan(vlan)

@pytest.mark.skipif(StrictVersion(platform.linux_distribution()[1]) <= StrictVersion('8.9'),
@pytest.mark.skipif(StrictVersion(distro.linux_distribution()[1]) <= StrictVersion('8.9'),
reason="Debian 8.9 or before has no support")
@pytest.mark.parametrize("test_input, expected", [
(["untagged"], ["SAI_VLAN_TAGGING_MODE_UNTAGGED"]),
Expand Down

0 comments on commit c7c63ee

Please sign in to comment.