From a0c0e817ad0e83fd254c118ef1d23bb8cebf087b Mon Sep 17 00:00:00 2001 From: "Fanani M. Ihsan" Date: Mon, 30 May 2016 09:59:39 +0700 Subject: [PATCH] update test --- .travis.yml | 2 +- test.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4b3352a..b6614b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,4 @@ language: python python: - "2.7" # command to run tests -script: notest +script: python test.py diff --git a/test.py b/test.py index d52f13a..5310073 100644 --- a/test.py +++ b/test.py @@ -5,10 +5,11 @@ sys.path.append("zk") import zk from zk import const +conn = False zk = zk.ZK('192.168.1.201', port=4370, timeout=5) -print 'Connecting to device ...' -conn = zk.connect() -if conn: +try: + print 'Connecting to device ...' + conn = zk.connect() print 'Disabling device ...' zk.disable_device() print 'Firmware Version: : {}'.format(zk.get_firmware_version()) @@ -43,3 +44,8 @@ if conn: print 'Disconnecting to device ...' zk.disconnect() +except Exception, e: + print "Process terminate : {}".format(e) +finally: + if conn: + zk.disconnect()