diff mbox series

[4/4] tests/acceptance/cpu_queries.py: minor optmizations

Message ID 20190911004204.29286-5-crosa@redhat.com
State New
Headers show
Series Acceptance tests: cpu_queries.py improvements | expand

Commit Message

Cleber Rosa Sept. 11, 2019, 12:42 a.m. UTC
This avoids the second loop over the cpus, and reuses some of the
variables.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 tests/acceptance/cpu_queries.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/tests/acceptance/cpu_queries.py b/tests/acceptance/cpu_queries.py
index 9cd6f553ff..54aa310fb8 100644
--- a/tests/acceptance/cpu_queries.py
+++ b/tests/acceptance/cpu_queries.py
@@ -25,9 +25,8 @@  class QueryCPUModelExpansion(Test):
 
         cpus = self.vm.command('query-cpu-definitions')
         for c in cpus:
-            self.assertNotIn('', c['unavailable-features'], c['name'])
-
-        for c in cpus:
-            model = {'name': c['name']}
-            e = self.vm.command('query-cpu-model-expansion', model=model, type='full')
-            self.assertEquals(e['model']['name'], c['name'])
+            model_name = c['name']
+            self.assertNotIn('', c['unavailable-features'], model_name)
+            e = self.vm.command('query-cpu-model-expansion',
+                                model={'name': model_name}, type='full')
+            self.assertEquals(e['model']['name'], model_name)