From b7d497b904200b65ce16f66fafb4d30decced00b Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Thu, 4 Jun 2020 15:06:31 -0700 Subject: [PATCH] sta_connect_example.py: shows example of how to get passing state and failure messages --- py-scripts/sta_connect_example.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/py-scripts/sta_connect_example.py b/py-scripts/sta_connect_example.py index 57319d94..54be75f9 100755 --- a/py-scripts/sta_connect_example.py +++ b/py-scripts/sta_connect_example.py @@ -3,17 +3,17 @@ # Example of how to instantiate StaConnect and run the test import sys + if sys.version_info[0] != 3: print("This script requires Python 3") exit(1) if 'py-json' not in sys.path: sys.path.append('../py-json') -from LANforge.LFUtils import * # if you lack __init__.py in this directory you will not find sta_connect module -import sta_connect from sta_connect import StaConnect + def main(): staConnect = StaConnect("localhost", 8080) staConnect.sta_mode = 0 @@ -24,9 +24,15 @@ def main(): staConnect.dut_ssid = "jedway-wpa2-x2048-5-1" staConnect.dut_passwd = "jedway-wpa2-x2048-5-1" staConnect.run() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: "+result) + is_passing = staConnect.passes() + if is_passing == False: + # run_results = staConnect.get_failed_result_list() + fail_message = staConnect.get_fail_message() + print("Some tests failed:\n" + fail_message) + else: + print("Tests pass") + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -