Skip to content

Commit c7c63ee

Browse files
committed
[vstest]: change from platform to distro
platform.linux_distribution is no longer supported 3.8+ Signed-off-by: Guohan Lu <[email protected]>
1 parent d7ff1ad commit c7c63ee

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/test_mirror.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This test suite covers the functionality of mirror feature in SwSS
2-
import platform
2+
import distro
33
import pytest
44
import time
55

@@ -235,7 +235,7 @@ def remove_fdb(self, vlan, mac):
235235

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

443443
# Ignore testcase in Debian Jessie
444444
# TODO: Remove this skip if Jessie support is no longer needed
445-
@pytest.mark.skipif(StrictVersion(platform.linux_distribution()[1]) <= StrictVersion('8.9'), reason="Debian 8.9 or before has no support")
445+
@pytest.mark.skipif(StrictVersion(distro.linux_distribution()[1]) <= StrictVersion('8.9'), reason="Debian 8.9 or before has no support")
446446
def test_MirrorDestMoveVlan(self, dvs, testlog):
447447
"""
448448
This test tests mirror session destination move from non-VLAN to VLAN

tests/test_vlan.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import platform
1+
import distro
22
import pytest
33

44
from distutils.version import StrictVersion
@@ -158,7 +158,7 @@ def test_VlanIncrementalConfig(self, dvs):
158158
self.dvs_vlan.remove_vlan(vlan)
159159
self.dvs_vlan.get_and_verify_vlan_ids(0)
160160

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

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

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

386386
self.dvs_vlan.remove_vlan(vlan)
387387

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

0 commit comments

Comments
 (0)