summaryrefslogtreecommitdiff
path: root/test-cli/test/helpers
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-03-09 12:39:50 +0100
committerHector Fernandez <hector@iatec.biz>2020-03-09 12:39:50 +0100
commitc685367cbd6abf1c6ae442df759e39b25a907d3b (patch)
tree37a942f44512c7b567447de41b1ff2c8496898be /test-cli/test/helpers
parenta03055f657d2e970e45e7ea2a3e66857f821eabd (diff)
downloadboard-c685367cbd6abf1c6ae442df759e39b25a907d3b.zip
board-c685367cbd6abf1c6ae442df759e39b25a907d3b.tar.gz
board-c685367cbd6abf1c6ae442df759e39b25a907d3b.tar.bz2
Fixed several test procedures.
Diffstat (limited to 'test-cli/test/helpers')
-rw-r--r--test-cli/test/helpers/amper.py1
-rw-r--r--test-cli/test/helpers/changedir.py14
-rwxr-xr-xtest-cli/test/helpers/usb.sh2
3 files changed, 15 insertions, 2 deletions
diff --git a/test-cli/test/helpers/amper.py b/test-cli/test/helpers/amper.py
index 45ec7db..ea719f6 100644
--- a/test-cli/test/helpers/amper.py
+++ b/test-cli/test/helpers/amper.py
@@ -1,6 +1,5 @@
import serial
import scanf
-import time
class Amper(object):
diff --git a/test-cli/test/helpers/changedir.py b/test-cli/test/helpers/changedir.py
new file mode 100644
index 0000000..fad9ade
--- /dev/null
+++ b/test-cli/test/helpers/changedir.py
@@ -0,0 +1,14 @@
+import os
+
+
+class changedir:
+ """Context manager for changing the current working directory"""
+ def __init__(self, newPath):
+ self.newPath = os.path.expanduser(newPath)
+
+ def __enter__(self):
+ self.savedPath = os.getcwd()
+ os.chdir(self.newPath)
+
+ def __exit__(self, etype, value, traceback):
+ os.chdir(self.savedPath) \ No newline at end of file
diff --git a/test-cli/test/helpers/usb.sh b/test-cli/test/helpers/usb.sh
index c8e6924..52ea4b2 100755
--- a/test-cli/test/helpers/usb.sh
+++ b/test-cli/test/helpers/usb.sh
@@ -11,4 +11,4 @@ for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
)
done
-return 0
+exit 0