aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common/exceptions.py
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2017-11-08 12:41:36 +0000
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2017-12-22 11:40:01 +0000
commit090b1a166bd19bdb98b0311d58b85582bd1676ed (patch)
tree74e9c509a9b5e58d8e69773f31dca85b78e13216 /yardstick/common/exceptions.py
parent9bef739e89f3b230c9e0a53c2286a440017ec948 (diff)
Replace subprocess "check_output" with "Popen"
"check_output" is a blocking wrapper for "Popen" which returns the output of the command execution or raises an exception in case of error. "Popen" is a non-blocking function that allows to create asynchronous tasks. It returns any possible execution error but doesn't raise an exception; this is delegated to the developer. This code is used in the Yardstick CLI base test class. Change-Id: Ie3e1228b2d40cb306354447653678bf581bc9697 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/common/exceptions.py')
-rw-r--r--yardstick/common/exceptions.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py
new file mode 100644
index 000000000..9c0ec2c19
--- /dev/null
+++ b/yardstick/common/exceptions.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2017 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+class ProcessExecutionError(RuntimeError):
+ def __init__(self, message, returncode):
+ super(ProcessExecutionError, self).__init__(message)
+ self.returncode = returncode