diff options
Diffstat (limited to 'test-cli/test/helpers')
-rw-r--r-- | test-cli/test/helpers/amper.py | 1 | ||||
-rw-r--r-- | test-cli/test/helpers/changedir.py | 14 | ||||
-rwxr-xr-x | test-cli/test/helpers/usb.sh | 2 |
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 |