From: Dirk Mueller Date: Sun, 23 Jun 2013 12:06:55 +0000 (+0200) Subject: Avoid winning the useless use of cat award X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=7c0e21ad3f9241f7c7550971d33bcf858b5f17dc;p=openstack-build%2Fcinder-build.git Avoid winning the useless use of cat award We can use file operations directly, no need to run cat(1) Change-Id: Id8a9f615dfb11d1bd7acd4a7d6f40545c246e5cd --- 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)