diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-12-06 20:53:35 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-12-06 20:53:35 +0100 |
commit | 95459d4111fd1488dc811de29db29420c06cf52b (patch) | |
tree | 5d27544f29a9bdd41f3c687d6f96b92cc39fce3a /smoketest/scripts | |
parent | 6366cacaf1c14ef99b5c3cfa8d553cd5004ccfc9 (diff) | |
download | vyos-1x-95459d4111fd1488dc811de29db29420c06cf52b.tar.gz vyos-1x-95459d4111fd1488dc811de29db29420c06cf52b.zip |
smoketest: interface: move to Python3 'f'ormatted string
Diffstat (limited to 'smoketest/scripts')
-rw-r--r-- | smoketest/scripts/cli/base_interfaces_test.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py index 615317368..4187fd77c 100644 --- a/smoketest/scripts/cli/base_interfaces_test.py +++ b/smoketest/scripts/cli/base_interfaces_test.py @@ -16,7 +16,9 @@ import os import unittest import json -from netifaces import ifaddresses, AF_INET, AF_INET6 +from netifaces import ifaddresses +from netifaces import AF_INET +from netifaces import AF_INET6 from vyos.configsession import ConfigSession from vyos.ifconfig import Interface @@ -99,7 +101,7 @@ class BasicInterfaceTest: Check if description can be added to interface """ for intf in self._interfaces: - test_string='Description-Test-{}'.format(intf) + test_string=f'Description-Test-{intf}' self.session.set(self._base_path + [intf, 'description', test_string]) for option in self._options.get(intf, []): self.session.set(self._base_path + [intf] + option.split()) @@ -108,8 +110,8 @@ class BasicInterfaceTest: # Validate interface description for intf in self._interfaces: - test_string='Description-Test-{}'.format(intf) - with open('/sys/class/net/{}/ifalias'.format(intf), 'r') as f: + test_string=f'Description-Test-{intf}' + with open(f'/sys/class/net/{intf}/ifalias', 'r') as f: tmp = f.read().rstrip() self.assertTrue(tmp, test_string) @@ -182,7 +184,7 @@ class BasicInterfaceTest: def _mtu_test(self, intf): """ helper function to verify MTU size """ - with open('/sys/class/net/{}/mtu'.format(intf), 'r') as f: + with open(f'/sys/class/net/{intf}/mtu', 'r') as f: tmp = f.read().rstrip() self.assertEqual(tmp, self._mtu) |