From 95459d4111fd1488dc811de29db29420c06cf52b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 6 Dec 2020 20:53:35 +0100 Subject: smoketest: interface: move to Python3 'f'ormatted string --- smoketest/scripts/cli/base_interfaces_test.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'smoketest/scripts') 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) -- cgit v1.2.3