Skip to content

Commit

Permalink
test wip
Browse files Browse the repository at this point in the history
  • Loading branch information
attdona committed Oct 1, 2017
1 parent fd7e566 commit 197276b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions burba/tests/tc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""global test configuration
"""
import os
import asyncio

#broker_url
broker='mqtt://localhost:1883'
Expand All @@ -16,5 +19,18 @@
}

def check_test_requirements():
"""required test values
"""
assert 'TEST_UID' in os.environ, "unset env variable TEST_UID"
assert 'TEST_PWD' in os.environ, "unset env variable TEST_PWD"

def cancel_tasks():
"""Cancel background tasks to reset environment between test cases
"""
pendings = asyncio.Task.all_tasks()

current_task = asyncio.Task.current_task()
for task in pendings:

if (task != current_task):
task.cancel()
1 change: 1 addition & 0 deletions burba/tests/test_cc3200_mqtt_leds.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,4 @@ async def test_switch_led():
await asyncio.sleep(1)
await cli.disconnect()
await broker.shutdown()
tc.cancel_tasks()
1 change: 1 addition & 0 deletions burba/tests/test_cc3200_mqtt_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,6 @@ async def test_add_profile():
finally:
await cli.disconnect()
await broker.shutdown()
tc.cancel_tasks()


0 comments on commit 197276b

Please sign in to comment.