summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-01 20:38:56 +0200
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-04-02 16:33:59 +0000
commitb3fb51cd799d231d16425faa1495bc6b9188d814 (patch)
tree2c16e8b4d441308462f18644efa6d0270ff826c2 /src/tests
parent9f831714ef0f32264e7046a5ecb86d74f24ec4ac (diff)
downloadvyos-1x-b3fb51cd799d231d16425faa1495bc6b9188d814.tar.gz
vyos-1x-b3fb51cd799d231d16425faa1495bc6b9188d814.zip
utils: T5738: always use vyos.utils.network.interface_exists over os.path.exists
(cherry picked from commit 5bb27f0c6220fd940b63cdd37a60c312c0ac3efd)
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_template.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tests/test_template.py b/src/tests/test_template.py
index aba97015e..dbb86b40b 100644
--- a/src/tests/test_template.py
+++ b/src/tests/test_template.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020-2023 VyOS maintainers and contributors
+# Copyright (C) 2020-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -14,9 +14,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import vyos.template
+from vyos.utils.network import interface_exists
from ipaddress import ip_network
from unittest import TestCase
@@ -26,7 +26,7 @@ class TestVyOSTemplate(TestCase):
def test_is_interface(self):
for interface in ['lo', 'eth0']:
- if os.path.exists(f'/sys/class/net/{interface}'):
+ if interface_exists(interface):
self.assertTrue(vyos.template.is_interface(interface))
else:
self.assertFalse(vyos.template.is_interface(interface))