From 7c0e21ad3f9241f7c7550971d33bcf858b5f17dc Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 23 Jun 2013 14:06:55 +0200 Subject: [PATCH] Avoid winning the useless use of cat award We can use file operations directly, no need to run cat(1) Change-Id: Id8a9f615dfb11d1bd7acd4a7d6f40545c246e5cd --- cinder/tests/test_wsgi.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cinder/tests/test_wsgi.py b/cinder/tests/test_wsgi.py index 37cf85e57..e8ac5cc8b 100644 --- a/cinder/tests/test_wsgi.py +++ b/cinder/tests/test_wsgi.py @@ -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) -- 2.45.2