]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Avoid winning the useless use of cat award
authorDirk Mueller <dirk@dmllr.de>
Sun, 23 Jun 2013 12:06:55 +0000 (14:06 +0200)
committerDirk Mueller <dirk@dmllr.de>
Tue, 25 Jun 2013 16:11:07 +0000 (18:11 +0200)
We can use file operations directly, no need
to run cat(1)

Change-Id: Id8a9f615dfb11d1bd7acd4a7d6f40545c246e5cd

cinder/tests/test_wsgi.py

index 37cf85e57713cf4d8a9f07fd066fbdbb87ddd740..e8ac5cc8b1fd822aaa708d4e42214dd3b8d2ad9e 100644 (file)
@@ -91,14 +91,11 @@ class TestWSGIServer(test.TestCase):
     """WSGI server tests."""
     def _ipv6_configured():
         try:
-            out, err = utils.execute('cat', '/proc/net/if_inet6')
-        except exception.ProcessExecutionError:
+            with file('/proc/net/if_inet6') as f:
+                return len(f.read()) > 0
+        except IOError:
             return False
 
-        if not out:
-            return False
-        return True
-
     def test_no_app(self):
         server = cinder.wsgi.Server("test_app", None)
         self.assertEquals("test_app", server.name)