diff options
author | Christian Breunig <christian@breunig.cc> | 2024-04-01 20:38:56 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-04-01 20:38:56 +0200 |
commit | 5bb27f0c6220fd940b63cdd37a60c312c0ac3efd (patch) | |
tree | 3908e55564363e97d6d62bcc9dc4ba9dcba82457 /src/tests/test_template.py | |
parent | 32d6a693de99021d2cd44fb4235e929caf7b4a6d (diff) | |
download | vyos-1x-5bb27f0c6220fd940b63cdd37a60c312c0ac3efd.tar.gz vyos-1x-5bb27f0c6220fd940b63cdd37a60c312c0ac3efd.zip |
utils: T5738: always use vyos.utils.network.interface_exists over os.path.exists
Diffstat (limited to 'src/tests/test_template.py')
-rw-r--r-- | src/tests/test_template.py | 6 |
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)) |